summaryrefslogtreecommitdiff
path: root/ldmicro
diff options
context:
space:
mode:
Diffstat (limited to 'ldmicro')
-rw-r--r--ldmicro/simpledialog.cpp205
1 files changed, 0 insertions, 205 deletions
diff --git a/ldmicro/simpledialog.cpp b/ldmicro/simpledialog.cpp
index f1ebd28..ed60ad2 100644
--- a/ldmicro/simpledialog.cpp
+++ b/ldmicro/simpledialog.cpp
@@ -59,72 +59,6 @@ static BOOL NoCheckingOnBox[MAX_BOXES];
#define SD_SHIFT_REGISTER 0x0000009
#define SD_FORMATTED_STRING 0x0000010
#define SD_PERSIST 0x0000011
-/*
-//-----------------------------------------------------------------------------
-// Don't allow any characters other than -A-Za-z0-9_ in the box.
-//-----------------------------------------------------------------------------
-static void MyAlnumOnlyProc (GtkEditable *editable, gchar *NewText, gint length,
- gint *position, gpointer data)
-{
- for (int i = 0; i < length; i++)
- {
- if (!(isalpha (NewText[i]) || NewText[i] == '_' || isdigit (NewText[i]) ||
- NewText[i] == '\b' || NewText[i] == '\'' || NewText[i] == '-'))
- {
- g_signal_stop_emission_by_name (G_OBJECT (editable), "insert-text");
- return;
- }
- }
- // if(msg == WM_CHAR) {
- // if(!(isalpha(wParam) || isdigit(wParam) || wParam == '_' ||
- // wParam == '\b' || wParam == '-' || wParam == '\''))
- // {
- // return 0;
- // }
- // }
-
- // int i;
- // for(i = 0; i < MAX_BOXES; i++) {
- // if(hwnd == Textboxes[i]) {
- // return CallWindowProc((WNDPROC)PrevAlnumOnlyProc[i], hwnd, msg,
- // wParam, lParam);
- // }
- // }
- // oops();
-}
-
-//-----------------------------------------------------------------------------
-// Don't allow any characters other than -0-9. in the box.
-//-----------------------------------------------------------------------------
-static void MyNumOnlyProc (GtkEditable *editable, gchar *NewText, gint length,
- gint *position, gpointer data)
-{
- for (int i = 0; i < length; i++)
- {
- if (!(isdigit (NewText[i]) || NewText[i] == '\b' ||
- NewText[i] == '.' || NewText[i] == '-'))
- {
- g_signal_stop_emission_by_name (G_OBJECT (editable), "insert-text");
- return;
- }
- }
- // if(msg == WM_CHAR) {
- // if(!(isdigit(wParam) || wParam == '.' || wParam == '\b'
- // || wParam == '-'))
- // {
- // return 0;
- // }
- // }
-
- // int i;
- // for(i = 0; i < MAX_BOXES; i++) {
- // if(hwnd == Textboxes[i]) {
- // return CallWindowProc((WNDPROC)PrevNumOnlyProc[i], hwnd, msg,
- // wParam, lParam);
- // }
- // }
- // oops();
-}*/
inline void DestroyWindow (int boxes){
for(int i = 0; i < boxes; i++) {
@@ -183,145 +117,6 @@ static void MakeControls(int boxes, char **labels, DWORD fixedFontMask)
QObject::connect(ButtonBox, SIGNAL(accepted()), SimpleDialog, SLOT(accept()));
QObject::connect(ButtonBox, SIGNAL(rejected()), SimpleDialog, SLOT(reject()));
}
-/*
-void SimpleDialogWrapUp()
-{
- // if(!didCancel)
- for(int i = 0; i < SDdata.boxes; i++) {
- if(NoCheckingOnBox[i]) {
- // char get[64];
- // SendMessage(Textboxes[i], WM_GETTEXT, 60, (LPARAM)get);
- char *get = (char*)gtk_entry_get_text (GTK_ENTRY(Textboxes[i]));
- strcpy(SDdata.dests[i], get);
- if (strlen(get) < 60)
- strcpy(SDdata.dests[i], get);
- else
- {
- strncpy(SDdata.dests[i], get, 60);
- SDdata.dests[i][60] = '\0';
- }
- } else {
- char get[20];
- // SendMessage(Textboxes[i], WM_GETTEXT, 15, (LPARAM)get);
- char *str = (char*)gtk_entry_get_text (GTK_ENTRY(Textboxes[i]));
- strcpy(get, str);
- if (strlen(str) < 15)
- strcpy(get, str);
- else
- {
- strncpy(get, str, 15);
- get[15] = '\0';
- }
-
- if( (!strchr(get, '\'')) ||
- (get[0] == '\'' && get[2] == '\'' && strlen(get)==3) )
- {
- if(strlen(get) == 0) {
- Error(_("Empty textbox; not permitted."));
- } else {
- strcpy(SDdata.dests[i], get);
- }
- } else {
- Error(_("Bad use of quotes: <%s>"), get);
- }
- }
- }
-
- switch(SDdata.uflag)
- {
- case SD_TIMER:
- {
- SDdata.str1[0] = 'T';
- strcpy(SDdata.str1+1, SDdata.dests[0]);
- //g_print("%s, %s\n", SDdata.str1, SDdata.dests[0]);
- double del = atof(SDdata.dests[1]);
- if(del > 2140000) { // 2**31/1000, don't overflow signed int
- Error(_("Delay too long; maximum is 2**31 us."));
- } else if(del <= 0) {
- Error(_("Delay cannot be zero or negative."));
- } else {
- *SDdata.num1 = (int)(1000*del + 0.5);
- }
- break;
- }
- case SD_COUNTER:
- {
- *SDdata.num1 = atoi(SDdata.dests[1]);
- break;
- }
- case SD_CMP:
- {
- break;
- }
- case SD_MOVE:
- {
- break;
- }
- case SD_READ_ADC:
- {
- break;
- }
- case SD_SET_PWM:
- {
- *SDdata.num1 = atoi(SDdata.dests[1]);
- break;
- }
- case SD_UART:
- {
- break;
- }
- case SD_MATH:
- {
- break;
- }
- case SD_SHIFT_REGISTER:
- {
- *SDdata.num1 = atoi(SDdata.dests[1]);
-
- if(*SDdata.num1 <= 0 || *SDdata.num1 >= 200)
- {
- Error(_("Not a reasonable size for a shift register."));
- *SDdata.num1 = 1;
- }
- break;
- }
- case SD_FORMATTED_STRING:
- {
- break;
- }
- case SD_PERSIST:
- {
- break;
- }
- }
-
- DestroyWindow(SimpleDialog);
- ProgramChanged();
- SIMPLE_DIALOG_ACTIVE = FALSE;
-}
-
-void SimpleDialogCancelProc()
-{
- DestroyWindow(SimpleDialog);
- ProgramChanged();
- SIMPLE_DIALOG_ACTIVE = FALSE;
-}
-
-static gboolean SimpleDialogKeyPressProc(HWID widget, GdkEventKey* event, gpointer data)
-{
- if(event -> keyval == GDK_KEY_Return)
- {
- // DialogDone = TRUE;
- SimpleDialogWrapUp();
- } else if(event -> keyval == GDK_KEY_Escape)
- {
- // DialogDone = TRUE;
- // DialogCancel = TRUE;
- SimpleDialogCancelProc();
- }
-
- return FALSE;
-}*/
BOOL ShowSimpleDialog(char *title, int boxes, char **labels, DWORD numOnlyMask,
DWORD alnumOnlyMask, DWORD fixedFontMask, char **dests)