Attempt at a dummy video dialog fix and fixed mythes's function duplication issues once and for all.
Originally committed to SVN as r1140.
This commit is contained in:
parent
dfeb714019
commit
399a7396cf
2 changed files with 16 additions and 20 deletions
|
@ -150,16 +150,11 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent)
|
||||||
fg->AddStretchSpacer();
|
fg->AddStretchSpacer();
|
||||||
fg->Add(length_display, 0, wxEXPAND|wxALIGN_CENTRE_VERTICAL|wxALIGN_LEFT);
|
fg->Add(length_display, 0, wxEXPAND|wxALIGN_CENTRE_VERTICAL|wxALIGN_LEFT);
|
||||||
wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
main_sizer->Add(fg, 0, wxALL|wxEXPAND, 5);
|
main_sizer->Add(fg, 1, wxALL|wxEXPAND, 5);
|
||||||
main_sizer->Add(CreateSeparatedButtonSizer(wxOK|wxCANCEL), 0, wxALL|wxEXPAND, 5);
|
main_sizer->Add(CreateSeparatedButtonSizer(wxOK|wxCANCEL), 0, wxALL|wxEXPAND, 5);
|
||||||
ok_button = static_cast<wxButton*>(FindWindow(wxID_OK));
|
ok_button = static_cast<wxButton*>(FindWindow(wxID_OK));
|
||||||
cancel_button = static_cast<wxButton*>(FindWindow(wxID_CANCEL));
|
cancel_button = static_cast<wxButton*>(FindWindow(wxID_CANCEL));
|
||||||
|
|
||||||
// Layout
|
|
||||||
main_sizer->SetSizeHints(this);
|
|
||||||
SetSizer(main_sizer);
|
|
||||||
CenterOnParent();
|
|
||||||
|
|
||||||
// Initialise controls
|
// Initialise controls
|
||||||
int lastwidth, lastheight, lastres = 0;
|
int lastwidth, lastheight, lastres = 0;
|
||||||
lastwidth = Options.AsInt(_T("Video Dummy Last Width"));
|
lastwidth = Options.AsInt(_T("Video Dummy Last Width"));
|
||||||
|
@ -181,6 +176,11 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent)
|
||||||
length->SetRange(0, 0x10000000);
|
length->SetRange(0, 0x10000000);
|
||||||
length->SetValue(Options.AsInt(_T("Video Dummy Last Length")));
|
length->SetValue(Options.AsInt(_T("Video Dummy Last Length")));
|
||||||
UpdateLengthDisplay();
|
UpdateLengthDisplay();
|
||||||
|
|
||||||
|
// Layout
|
||||||
|
main_sizer->SetSizeHints(this);
|
||||||
|
SetSizer(main_sizer);
|
||||||
|
CenterOnParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,8 @@
|
||||||
|
|
||||||
// some basic utility routines
|
// some basic utility routines
|
||||||
|
|
||||||
#ifndef HAVE_HUNSPELL
|
|
||||||
// string duplication routine
|
// string duplication routine
|
||||||
char * mystrdup(const char * p)
|
char * mythes_mystrdup(const char * p)
|
||||||
{
|
{
|
||||||
|
|
||||||
int sl = strlen(p) + 1;
|
int sl = strlen(p) + 1;
|
||||||
|
@ -57,15 +56,12 @@ char * mystrdup(const char * p)
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove cross-platform text line end characters
|
// remove cross-platform text line end characters
|
||||||
void mychomp(char * s)
|
void mythes_mychomp(char * s)
|
||||||
{
|
{
|
||||||
int k = strlen(s);
|
int k = strlen(s);
|
||||||
if ((k > 0) && ((*(s+k-1)=='\r') || (*(s+k-1)=='\n'))) *(s+k-1) = '\0';
|
if ((k > 0) && ((*(s+k-1)=='\r') || (*(s+k-1)=='\n'))) *(s+k-1) = '\0';
|
||||||
if ((k > 1) && (*(s+k-2) == '\r')) *(s+k-2) = '\0';
|
if ((k > 1) && (*(s+k-2) == '\r')) *(s+k-2) = '\0';
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
char * mystrdup(const char * p);
|
|
||||||
void mychomp(char * s);
|
|
||||||
|
|
||||||
|
|
||||||
// return index of char in string
|
// return index of char in string
|
||||||
|
@ -121,7 +117,7 @@ int MyThes::thInitialize(const char* idxpath, const char* datpath)
|
||||||
char * wrd;
|
char * wrd;
|
||||||
wrd = (char *)calloc(1, MAX_WD_LEN);
|
wrd = (char *)calloc(1, MAX_WD_LEN);
|
||||||
int len = readLine(pifile,wrd,MAX_WD_LEN);
|
int len = readLine(pifile,wrd,MAX_WD_LEN);
|
||||||
encoding = mystrdup(wrd);
|
encoding = mythes_mystrdup(wrd);
|
||||||
len = readLine(pifile,wrd,MAX_WD_LEN);
|
len = readLine(pifile,wrd,MAX_WD_LEN);
|
||||||
int idxsz = atoi(wrd);
|
int idxsz = atoi(wrd);
|
||||||
|
|
||||||
|
@ -262,10 +258,10 @@ int MyThes::Lookup(const char * pText, int len, mentry** pme)
|
||||||
np = mystr_indexOfChar(p,'|');
|
np = mystr_indexOfChar(p,'|');
|
||||||
if (np >= 0) {
|
if (np >= 0) {
|
||||||
*(buf+np) = '\0';
|
*(buf+np) = '\0';
|
||||||
pos = mystrdup(p);
|
pos = mythes_mystrdup(p);
|
||||||
p = p + np + 1;
|
p = p + np + 1;
|
||||||
} else {
|
} else {
|
||||||
pos = mystrdup("");
|
pos = mythes_mystrdup("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// count the number of fields in the remaining line
|
// count the number of fields in the remaining line
|
||||||
|
@ -286,10 +282,10 @@ int MyThes::Lookup(const char * pText, int len, mentry** pme)
|
||||||
np = mystr_indexOfChar(d,'|');
|
np = mystr_indexOfChar(d,'|');
|
||||||
if (np > 0) {
|
if (np > 0) {
|
||||||
*(d+np) = '\0';
|
*(d+np) = '\0';
|
||||||
pm->psyns[j] = mystrdup(d);
|
pm->psyns[j] = mythes_mystrdup(d);
|
||||||
d = d + np + 1;
|
d = d + np + 1;
|
||||||
} else {
|
} else {
|
||||||
pm->psyns[j] = mystrdup(d);
|
pm->psyns[j] = mythes_mystrdup(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,9 +296,9 @@ int MyThes::Lookup(const char * pText, int len, mentry** pme)
|
||||||
strncpy(dfn,pos,k);
|
strncpy(dfn,pos,k);
|
||||||
*(dfn+k) = ' ';
|
*(dfn+k) = ' ';
|
||||||
strncpy((dfn+k+1),(pm->psyns[0]),m+1);
|
strncpy((dfn+k+1),(pm->psyns[0]),m+1);
|
||||||
pm->defn = mystrdup(dfn);
|
pm->defn = mythes_mystrdup(dfn);
|
||||||
} else {
|
} else {
|
||||||
pm->defn = mystrdup(pm->psyns[0]);
|
pm->defn = mythes_mystrdup(pm->psyns[0]);
|
||||||
}
|
}
|
||||||
free(pos);
|
free(pos);
|
||||||
pm++;
|
pm++;
|
||||||
|
@ -355,7 +351,7 @@ int MyThes::readLine(FILE * pf, char * buf, int nc)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (fgets(buf,nc,pf)) {
|
if (fgets(buf,nc,pf)) {
|
||||||
mychomp(buf);
|
mythes_mychomp(buf);
|
||||||
return strlen(buf);
|
return strlen(buf);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in a new issue