diff options
author | akshay-c | 2019-02-04 10:47:13 +0530 |
---|---|---|
committer | akshay-c | 2019-02-04 10:47:13 +0530 |
commit | a962c0a7965f6c0d80c867ba9f3fbe797ac14de7 (patch) | |
tree | 54e8f72c170cadcee9c7d06e755e3c768dc51327 | |
parent | 4196481f74afb84e5cc59cdf00c06c1ca1becab7 (diff) | |
download | LDmicroQt-a962c0a7965f6c0d80c867ba9f3fbe797ac14de7.tar.gz LDmicroQt-a962c0a7965f6c0d80c867ba9f3fbe797ac14de7.tar.bz2 LDmicroQt-a962c0a7965f6c0d80c867ba9f3fbe797ac14de7.zip |
Create statusbar
-rw-r--r-- | ldmicro/draw_outputdev.cpp | 1 | ||||
-rw-r--r-- | ldmicro/ldmicro.cpp | 16 | ||||
-rw-r--r-- | ldmicro/lib/freezeLD/freezeLD.cpp | 13 | ||||
-rw-r--r-- | ldmicro/maincontrols.cpp | 40 | ||||
-rw-r--r-- | ldmicro/miscutil.cpp | 4 |
5 files changed, 41 insertions, 33 deletions
diff --git a/ldmicro/draw_outputdev.cpp b/ldmicro/draw_outputdev.cpp index 920978c..12dcb87 100644 --- a/ldmicro/draw_outputdev.cpp +++ b/ldmicro/draw_outputdev.cpp @@ -403,6 +403,7 @@ static void SetSyntaxHighlightingColours(void) //----------------------------------------------------------------------------- void InitForDrawing(void) { + DrawWindow = new QWidget; SetSyntaxHighlightingColours(); FixedWidthFont = CreateFont( diff --git a/ldmicro/ldmicro.cpp b/ldmicro/ldmicro.cpp index 3e315ce..2b27ce5 100644 --- a/ldmicro/ldmicro.cpp +++ b/ldmicro/ldmicro.cpp @@ -1271,11 +1271,25 @@ int main(int argc, char** argv) //Icon for main window MainWindow->setWindowIcon(*MWIcon); MakeMainWindowMenus(); + MakeDialogBoxClass(); InitForDrawing(); + + ThawWindowPos(MainWindow); + IoListHeight = 100; + ThawDWORD(IoListHeight); + MakeMainWindowControls(); - MainWindow->show(); MainWindowResized(); + MenuHandler(); + + NewProgram(); + strcpy(CurrentSaveFile, ""); + + MainWindow->show(); + + GenerateIoListDontLoseSelection(); + // MakeDialogBoxClass(); diff --git a/ldmicro/lib/freezeLD/freezeLD.cpp b/ldmicro/lib/freezeLD/freezeLD.cpp index aad4be7..6ae42eb 100644 --- a/ldmicro/lib/freezeLD/freezeLD.cpp +++ b/ldmicro/lib/freezeLD/freezeLD.cpp @@ -137,7 +137,7 @@ static void Clamp(LONG *v, LONG min, LONG max) */ void ThawWindowPosF(HWID hwid, char *subKey, char *name) { - /*char* Ld_CWD = (char *)malloc(MAX_PATH); + char* Ld_CWD = (char *)malloc(MAX_PATH); getcwd(Ld_CWD, MAX_PATH); if (!Ld_CWD) @@ -191,7 +191,10 @@ void ThawWindowPosF(HWID hwid, char *subKey, char *name) Register.read((char*) &newKey2, sizeof(newKey2)); Register.close(); if (newKey1.type == 'i' && newKey2.type == 'i') - gtk_window_resize(GTK_WINDOW(hwid), newKey1.val.i, newKey2.val.i); + { + QSize MwSize(newKey1.val.i,newKey2.val.i); + hwid->resize(MwSize); + } /// set position @@ -217,7 +220,7 @@ void ThawWindowPosF(HWID hwid, char *subKey, char *name) Register.read((char*) &newKey2, sizeof(newKey2)); Register.close(); if (newKey1.type == 'i' && newKey2.type == 'i') - gtk_window_move(GTK_WINDOW(hwid), newKey1.val.i, newKey2.val.i); + hwid->move(newKey1.val.i, newKey2.val.i); sprintf(keyName, "%s_maximized", name); @@ -232,14 +235,14 @@ void ThawWindowPosF(HWID hwid, char *subKey, char *name) Register.close(); if (newKey1.type == 'b') if (newKey1.val.b) - gtk_window_maximize(GTK_WINDOW(hwid)); + hwid->showMaximized(); /// gtk_window_move handles off-screen window placement free(keyName); chdir(Ld_CWD); - free(Ld_CWD);*/ + free(Ld_CWD); } /* diff --git a/ldmicro/maincontrols.cpp b/ldmicro/maincontrols.cpp index ca0d9bc..976688b 100644 --- a/ldmicro/maincontrols.cpp +++ b/ldmicro/maincontrols.cpp @@ -546,13 +546,12 @@ void MakeMainWindowControls(void) /*QList<QTreeWidgetItem *> items; items.append(new QTreeWidgetItem(QStringList(QString("Item1")))); IoList->insertTopLevelItems(0, items);*/ - DrawWindow = new QWidget; DrawWindow->setAutoFillBackground(true); QSize DWSize; DWSize.setHeight(MainWindow->height() - IoListHeight); DWSize.setWidth(MainWindow->width()); - // DrawWindow->setMinimumHeight(100); + DrawWindow->setMinimumHeight(100); splitter->addWidget(DrawWindow); DrawWindow->resize(DWSize); /*QPalette pal = QPalette(); @@ -1007,7 +1006,7 @@ void SetUndoEnabled(BOOL undoEnabled, BOOL redoEnabled) UpdateMainWindowTitleBar(); RefreshControlsToSettings(); } - +*/ //----------------------------------------------------------------------------- // Cause the status bar and the list view to be in sync with the actual data // structures describing the settings and the I/O configuration. Listview @@ -1016,7 +1015,7 @@ void SetUndoEnabled(BOOL undoEnabled, BOOL redoEnabled) //----------------------------------------------------------------------------- void RefreshControlsToSettings(void) { - GtkTreeIter iter; + /*GtkTreeIter iter; BOOL path_not_empty = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(IoList), &iter); // g_print("path e = %i\n", path_not_empty); @@ -1067,23 +1066,16 @@ void RefreshControlsToSettings(void) } IoListOutOfSync = FALSE; - +*/ if(Prog.mcu) { - gtk_statusbar_push (GTK_STATUSBAR (StatusBar[0]), - gtk_statusbar_get_context_id (GTK_STATUSBAR (StatusBar[0]), "MCU Name"), - (gchar*)Prog.mcu->mcuName); + StatusBar[0]->setText(Prog.mcu->mcuName); } else { - gtk_statusbar_push (GTK_STATUSBAR (StatusBar[0]), - gtk_statusbar_get_context_id (GTK_STATUSBAR (StatusBar[0]), "MCU Name"), - "no MCU selected"); + StatusBar[0]->setText("no MCU selected"); } char buf[256]; sprintf(buf, _("cycle time %.2f ms"), (double)Prog.cycleTime/1000.0); - - gtk_statusbar_push (GTK_STATUSBAR (StatusBar[1]), - gtk_statusbar_get_context_id (GTK_STATUSBAR (StatusBar[1]), "Cycle time"), - buf); + StatusBar[1]->setText(buf); if(Prog.mcu && (Prog.mcu->whichIsa == ISA_ANSIC || Prog.mcu->whichIsa == ISA_INTERPRETED)) @@ -1093,11 +1085,9 @@ void RefreshControlsToSettings(void) sprintf(buf, _("processor clock %.4f MHz"), (double)Prog.mcuClock/1000000.0); } - gtk_statusbar_push (GTK_STATUSBAR (StatusBar[2]), - gtk_statusbar_get_context_id (GTK_STATUSBAR (StatusBar[2]), "Processor time"), - buf); - + StatusBar[2]->setText(buf); +/* for(i = 0; i < NUM_SUPPORTED_MCUS; i++) { if(&SupportedMcus[i] == Prog.mcu) { CheckMenuItem(ProcessorMenu, ProcessorMenuItems[i], MF_CHECKED); @@ -1112,7 +1102,7 @@ void RefreshControlsToSettings(void) } else { CheckMenuItem(ProcessorMenu, ProcessorMenuItems[NUM_SUPPORTED_MCUS], MF_UNCHECKED); - } + }*/ } //----------------------------------------------------------------------------- @@ -1121,7 +1111,7 @@ void RefreshControlsToSettings(void) //----------------------------------------------------------------------------- void GenerateIoListDontLoseSelection(void) { - GtkTreeIter iter; + /*GtkTreeIter iter; BOOL path_not_empty = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(IoList), &iter); // g_print("path e = %i\n", path_not_empty); @@ -1140,7 +1130,7 @@ void GenerateIoListDontLoseSelection(void) path = gtk_tree_model_get_path ( IoModelPtr , &iter ) ; i = gtk_tree_path_get_indices ( path ) ; IoListSelectionPoint = i[0]; - } + }*/ // gtk_tree_model_iter_next (GTK_TREE_MODEL(IoList), iter); // BOOL iter_v = gtk_list_store_iter_is_valid(GTK_LIST_STORE(IoList), iter); // g_print("iter = %i\n", iter_v); @@ -1152,14 +1142,14 @@ void GenerateIoListDontLoseSelection(void) // return i [ 0 ] ; // } - IoListSelectionPoint = GenerateIoList(IoListSelectionPoint); + /*IoListSelectionPoint = GenerateIoList(IoListSelectionPoint); // can't just update the listview index; if I/O has been added then the // new selection point might be out of range till we refill it - IoListOutOfSync = TRUE; + IoListOutOfSync = TRUE;*/ RefreshControlsToSettings(); } -*/ + //----------------------------------------------------------------------------- // Called when the main window has been resized. Adjust the size of the // status bar and the listview to reflect the new window size. diff --git a/ldmicro/miscutil.cpp b/ldmicro/miscutil.cpp index 5806dc1..9493943 100644 --- a/ldmicro/miscutil.cpp +++ b/ldmicro/miscutil.cpp @@ -305,7 +305,7 @@ void FixedFont(HWID h) // SendMessage(h, WM_SETFONT, (WPARAM)MyFixedFont, TRUE); } - +*/ //----------------------------------------------------------------------------- // Create our dialog box class, used for most of the popup dialogs. //----------------------------------------------------------------------------- @@ -339,7 +339,7 @@ void MakeDialogBoxClass(void) // if(!MyFixedFont) // MyFixedFont = (HFONT)GetStockObject(SYSTEM_FONT); -}*/ +} //----------------------------------------------------------------------------- // Map an I/O type to a string describing it. Used both in the on-screen |