summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatsuDrag92018-05-31 11:43:09 +0530
committerNatsuDrag92018-05-31 11:43:09 +0530
commit39d3eeb5fc8c969f8eed03e0c1fc818453cca6df (patch)
treef7d90029412fed4919a597e99f8517ea8652ee1c
parent82da829c02377db4c160ef7da06deea992989809 (diff)
downloadLDMicroGtk-39d3eeb5fc8c969f8eed03e0c1fc818453cca6df.tar.gz
LDMicroGtk-39d3eeb5fc8c969f8eed03e0c1fc818453cca6df.tar.bz2
LDMicroGtk-39d3eeb5fc8c969f8eed03e0c1fc818453cca6df.zip
Ported the function updating titlebar.
-rw-r--r--ldmicro/includes/ldmicro.h2
-rw-r--r--ldmicro/lib/linuxUI/linuxLD.h10
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.cpp94
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.h20
-rw-r--r--ldmicro/maincontrols.cpp13
5 files changed, 73 insertions, 66 deletions
diff --git a/ldmicro/includes/ldmicro.h b/ldmicro/includes/ldmicro.h
index 579d3a7..50299ee 100644
--- a/ldmicro/includes/ldmicro.h
+++ b/ldmicro/includes/ldmicro.h
@@ -747,7 +747,7 @@ void SetAdcShadow(char *name, SWORD val);
SWORD GetAdcShadow(char *name);
void DestroyUartSimulationWindow(void);
void ShowUartSimulationWindow(void);
-extern BOOL InSimulationMode;
+extern BOOL InSimulationMode;
extern BOOL SimulateRedrawAfterNextCycle;
// compilecommon.cpp
diff --git a/ldmicro/lib/linuxUI/linuxLD.h b/ldmicro/lib/linuxUI/linuxLD.h
index c1b0829..fc60259 100644
--- a/ldmicro/lib/linuxUI/linuxLD.h
+++ b/ldmicro/lib/linuxUI/linuxLD.h
@@ -26,11 +26,11 @@ typedef CONST CHAR *LPCSTR; /// should be __nullterminated
typedef LPCSTR LPCTSTR;
#endif
-#ifdef UNICODE
- typedef LPWSTR LPTSTR;
-#else
- typedef LPSTR LPTSTR;
-#endif
+// #ifdef UNICODE
+// typedef LPWSTR LPTSTR;
+// #else
+// typedef LPSTR LPTSTR;
+// #endif
/// all handles will hold a GtkWindow* type
typedef void* PVOID;
diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp
index 6dabd80..8904f77 100644
--- a/ldmicro/lib/linuxUI/linuxUI.cpp
+++ b/ldmicro/lib/linuxUI/linuxUI.cpp
@@ -38,6 +38,12 @@ int ScrollWidth; // Width of scrolli
int ScrollHeight; // Height of scrolling
HWID IoList; // Window for list view
+// ldmicro.cpp
+char CurrentSaveFile[MAX_PATH];
+
+// Simulation Mode
+BOOL InSimulationMode;
+
/// Wraper function for gtk_window_has_toplevel_focus
BOOL isFocus(HWID window)
{
@@ -94,51 +100,51 @@ void MessageBox(HWID pWindow, char* message, char* title, UINT mFlags)
gtk_widget_destroy (dialog);
}
-BOOL GetSaveFileName(OPENFILENAME ofn)
-{
- GtkWidget *dialog;
- GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
-
- dialog = gtk_file_chooser_dialog_new ("Open File",
- GTK_WINDOW(window),
- action,
- "_Cancel",
- GTK_RESPONSE_CANCEL,
- "_Open",
- GTK_RESPONSE_ACCEPT,
- NULL);
-
- GtkFileFilter *filter = gtk_file_filter_new ();
- gtk_file_filter_add_pattern (filter, "*");
- gtk_file_filter_set_name (filter, "All files");
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
- filter = gtk_file_filter_new ();
- gtk_file_filter_add_pattern (filter, "*.c");
- gtk_file_filter_add_pattern (filter, "*.cpp");
- gtk_file_filter_set_name (filter, "C source files");
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
- filter = gtk_file_filter_new ();
- gtk_file_filter_add_pattern (filter, "*.h");
- gtk_file_filter_set_name (filter, "C hedder files");
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+// BOOL GetSaveFileName(OPENFILENAME ofn)
+// {
+// GtkWidget *dialog;
+// GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
+
+// dialog = gtk_file_chooser_dialog_new ("Open File",
+// GTK_WINDOW(window),
+// action,
+// "_Cancel",
+// GTK_RESPONSE_CANCEL,
+// "_Open",
+// GTK_RESPONSE_ACCEPT,
+// NULL);
+
+// GtkFileFilter *filter = gtk_file_filter_new ();
+// gtk_file_filter_add_pattern (filter, "*");
+// gtk_file_filter_set_name (filter, "All files");
+// gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+
+// filter = gtk_file_filter_new ();
+// gtk_file_filter_add_pattern (filter, "*.c");
+// gtk_file_filter_add_pattern (filter, "*.cpp");
+// gtk_file_filter_set_name (filter, "C source files");
+// gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+
+// filter = gtk_file_filter_new ();
+// gtk_file_filter_add_pattern (filter, "*.h");
+// gtk_file_filter_set_name (filter, "C hedder files");
+// gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
- filter = gtk_file_filter_new ();
- gtk_file_filter_add_pattern (filter, "*.hex");
- gtk_file_filter_set_name (filter, "hex files");
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+// filter = gtk_file_filter_new ();
+// gtk_file_filter_add_pattern (filter, "*.hex");
+// gtk_file_filter_set_name (filter, "hex files");
+// gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
- filter = gtk_file_filter_new ();
- gtk_file_filter_add_pattern (filter, "*.int");
- gtk_file_filter_set_name (filter, "int files");
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
- gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
+// filter = gtk_file_filter_new ();
+// gtk_file_filter_add_pattern (filter, "*.int");
+// gtk_file_filter_set_name (filter, "int files");
+// gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+// gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
- BOOL exitStatus = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
- if (exitStatus)
- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
- gtk_widget_destroy (dialog);
+// BOOL exitStatus = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+// if (exitStatus)
+// filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+// gtk_widget_destroy (dialog);
- return exitStatus;
-} \ No newline at end of file
+// return exitStatus;
+// } \ No newline at end of file
diff --git a/ldmicro/lib/linuxUI/linuxUI.h b/ldmicro/lib/linuxUI/linuxUI.h
index 920dcce..18afd60 100644
--- a/ldmicro/lib/linuxUI/linuxUI.h
+++ b/ldmicro/lib/linuxUI/linuxUI.h
@@ -30,16 +30,16 @@
/// data types
-typedef struct OpenFileInfoData {
- DWORD lStructSize;
- HWID parentWindow;
- LPCTSTR lpstrFilter;
- LPTSTR lpstrFile;
- DWORD nMaxFile;
- LPCTSTR lpstrTitle;
- DWORD Flags;
- LPCTSTR lpstrDefExt;
-} OPENFILENAME;
+// typedef struct OpenFileInfoData {
+// DWORD lStructSize;
+// HWID parentWindow;
+// LPCTSTR lpstrFilter;
+// LPTSTR lpstrFile;
+// DWORD nMaxFile;
+// LPCTSTR lpstrTitle;
+// DWORD Flags;
+// LPCTSTR lpstrDefExt;
+// } OPENFILENAME;
/// functions
BOOL isFocus(HWID);
diff --git a/ldmicro/maincontrols.cpp b/ldmicro/maincontrols.cpp
index f9cc95a..7fc708c 100644
--- a/ldmicro/maincontrols.cpp
+++ b/ldmicro/maincontrols.cpp
@@ -116,23 +116,24 @@ void MakeMainWindowControls(void)
//-----------------------------------------------------------------------------
void UpdateMainWindowTitleBar(void)
{
- char line[MAX_PATH+100];
+ char line[PATH_MAX+100];
if(InSimulationMode) {
if(RealTimeSimulationRunning) {
- strcpy(line, _("LDmicro - Simulation (Running)"));
+ strcpy(line, "LDmicro - Simulation (Running)");
} else {
- strcpy(line, _("LDmicro - Simulation (Stopped)"));
+ strcpy(line, "LDmicro - Simulation (Stopped)");
}
} else {
- strcpy(line, _("LDmicro - Program Editor"));
+ strcpy(line, "LDmicro - Program Editor");
}
if(strlen(CurrentSaveFile) > 0) {
sprintf(line+strlen(line), " - %s", CurrentSaveFile);
} else {
- strcat(line, _(" - (not yet saved)"));
+ strcat(line, " - (not yet saved)");
}
+
+ gtk_window_set_title (GTK_WINDOW (window), line);
- SetWindowText(MainWindow, line);
}
//-----------------------------------------------------------------------------