Skip to content

Commit

Permalink
Merge pull request #3 from justinfrankel/master
Browse files Browse the repository at this point in the history
merge recent commits from official repo
  • Loading branch information
zeppelinux authored May 15, 2020
2 parents 6091fe1 + fb1a68b commit fbb5524
Show file tree
Hide file tree
Showing 39 changed files with 3,568 additions and 2,633 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*.bat text eol=crlf
*.cmd text eol=crlf

*.rc text eol=crlf
*.dsp text eol=crlf
*.dsw text eol=crlf
*.sln text eol=crlf
Expand Down
1 change: 1 addition & 0 deletions WDL/.gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*.bat text eol=crlf
*.cmd text eol=crlf

*.rc text eol=crlf
*.dsp text eol=crlf
*.dsw text eol=crlf
*.sln text eol=crlf
Expand Down
10 changes: 6 additions & 4 deletions WDL/assocarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,15 @@ template <class KEY, class VAL> class WDL_AssocArrayImpl
kv->val = val;
}

void Resort()
void Resort(int (*new_keycmp)(KEY *k1, KEY *k2)=NULL)
{
if (new_keycmp) m_keycmp = new_keycmp;
if (m_data.GetSize() > 1 && m_keycmp)
{
qsort(m_data.Get(), m_data.GetSize(), sizeof(KeyVal),
(int(*)(const void*, const void*))m_keycmp);
RemoveDuplicateKeys();
if (!new_keycmp)
RemoveDuplicateKeys();
}
}

Expand Down Expand Up @@ -393,11 +395,11 @@ template <class VAL> class WDL_LogicalSortStringKeyedArray : public WDL_StringKe

~WDL_LogicalSortStringKeyedArray() { }

private:

static int cmpstr(const char **a, const char **b) { return _cmpstr(*a, *b, true); }
static int cmpistr(const char **a, const char **b) { return _cmpstr(*a, *b, false); }

private:

static int _cmpstr(const char *s1, const char *s2, bool case_sensitive)
{
// this also exists as WDL_strcmp_logical in wdlcstring.h
Expand Down
6 changes: 6 additions & 0 deletions WDL/eel2/eel_lice.h
Original file line number Diff line number Diff line change
Expand Up @@ -2558,6 +2558,12 @@ LRESULT WINAPI eel_lice_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar
st[zp]=lowera;
}
}
#ifdef _WIN32
if (!a && (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN) && ((GetAsyncKeyState(VK_CONTROL)&0x8000)||(GetAsyncKeyState(VK_MENU)&0x8000)))
{
a = (int)MapVirtualKey((UINT)wParam,2/*MAPVK_VK_TO_CHAR*/);
}
#endif

if (a && uMsg != WM_KEYUP
#ifdef _WIN32
Expand Down
14 changes: 11 additions & 3 deletions WDL/filebrowse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ bool WDL_ChooseDirectory(HWND parent, const char *text, const char *initialdir,
#endif
}

static const char *stristr(const char* a, const char* b)
static WDL_STATICFUNC_UNUSED const char *stristr(const char* a, const char* b)
{
const size_t n = strlen(a), len = strlen(b);
for (size_t i = 0; i+len <= n; ++i) if (!strnicmp(a+i, b, len)) return a+i;
Expand Down Expand Up @@ -185,6 +185,8 @@ bool WDL_ChooseFileForSave(HWND parent,
char cwd[2048];
GetCurrentDirectory(sizeof(cwd),cwd);

while (defext && *defext == '.') defext++; // this function can be passed defext of either .wav or wav, we always want it to be the latter

#ifdef _WIN32
WDL_FileBrowse_Dis win32disfix(parent);
char temp[4096];
Expand Down Expand Up @@ -213,7 +215,9 @@ bool WDL_ChooseFileForSave(HWND parent,
{
if(*p) p+=strlen(p)+1;
if(!*p) break;
if(stristr(p, defext))
const char *ext = WDL_get_fileext(p);
if (*ext == '.') ext++;
if(!stricmp(ext,defext))
{
fd.setFileTypeIndex(i+1);
break;
Expand Down Expand Up @@ -279,7 +283,11 @@ bool WDL_ChooseFileForSave(HWND parent,
}
else
{
if (defext && *defext == '.') initialfile = defext; // SWELL supports default extension in filename field
if (defext && *defext)
{
snprintf(if_temp,sizeof(if_temp),".%s",defext); // SWELL treats initialfile of ".ext" as default extension
initialfile = if_temp;
}
}

bool r = BrowseForSaveFile(text,initialdir,initialfile,extlist,fn,fnsize);
Expand Down
Loading

0 comments on commit fbb5524

Please sign in to comment.