From 505423bab6418782ef2abd4e710ec2fbfc687dee Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 27 Feb 2005 20:39:02 +0000 Subject: [PATCH] Moved the log window so that it gets initialized as early as possible. Modified the tooltip word wrap a bit (trial-and-error). Looks better now. Nope, I don't know how it should be done right. --- src/mmg/mmg.cpp | 14 ++++++++++++-- src/mmg/mmg_dialog.h | 1 + src/mmg/tab_settings.cpp | 7 ++----- src/mmg/tab_settings.h | 1 - 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/mmg/mmg.cpp b/src/mmg/mmg.cpp index 1d5906755..f77ead550 100644 --- a/src/mmg/mmg.cpp +++ b/src/mmg/mmg.cpp @@ -501,9 +501,16 @@ format_date_time(time_t date_time) { #if defined(SYS_WINDOWS) wxString format_tooltip(const wxString &s) { - wxString tooltip(s); + wxString tooltip(s), nl(wxT("\n")); + unsigned int i; - return break_line(tooltip, 30); + for (i = 30; i < tooltip.length(); ++i) + if (wxT(' ') == tooltip[i]) + return tooltip.Left(i) + nl + tooltip.Right(tooltip.length() - i - 1); + else if (wxT('(') == tooltip[i]) + return tooltip.Left(i) + nl + tooltip.Right(tooltip.length() - i); + + return tooltip; } #endif @@ -583,6 +590,9 @@ mmg_dialog::mmg_dialog(): mdlg = this; + log_window = new wxLogWindow(this, wxT("mmg debug output"), false); + wxLog::SetActiveTarget(log_window); + file_menu = new wxMenu(); file_menu->Append(ID_M_FILE_NEW, wxT("&New\tCtrl-N"), wxT("Start with empty settings")); diff --git a/src/mmg/mmg_dialog.h b/src/mmg/mmg_dialog.h index cde70c83f..905809502 100644 --- a/src/mmg/mmg_dialog.h +++ b/src/mmg/mmg_dialog.h @@ -111,6 +111,7 @@ public: job_dialog *jdlg; wxHtmlHelpController *help; + wxLogWindow *log_window; bool warned_chapter_editor_not_empty; diff --git a/src/mmg/tab_settings.cpp b/src/mmg/tab_settings.cpp index 2debcf622..a6c38f65d 100644 --- a/src/mmg/tab_settings.cpp +++ b/src/mmg/tab_settings.cpp @@ -154,9 +154,6 @@ tab_settings::tab_settings(wxWindow *parent): siz_all->Add(siz_about, 0, wxGROW | wxALL, 5); SetSizer(siz_all); - log_window = new wxLogWindow(this, wxT("mmg debug output"), false); - wxLog::SetActiveTarget(log_window); - load_preferences(); } @@ -205,7 +202,7 @@ tab_settings::on_on_top_selected(wxCommandEvent &evt) { void tab_settings::on_gui_debugging_selected(wxCommandEvent &evt) { save_preferences(); - log_window->Show(cb_gui_debugging->IsChecked()); + mdlg->log_window->Show(cb_gui_debugging->IsChecked()); } void @@ -241,7 +238,7 @@ tab_settings::load_preferences() { cb_warn_usage->SetValue(b); cfg->Read(wxT("gui_debugging"), &b, false); cb_gui_debugging->SetValue(b); - log_window->Show(b); + mdlg->log_window->Show(b); } void diff --git a/src/mmg/tab_settings.h b/src/mmg/tab_settings.h index 6818cb59f..bfab34ad4 100644 --- a/src/mmg/tab_settings.h +++ b/src/mmg/tab_settings.h @@ -38,7 +38,6 @@ public: wxCheckBox *cb_filenew_after_add_to_jobqueue; wxCheckBox *cb_warn_usage, *cb_gui_debugging; wxComboBox *cob_priority; - wxLogWindow *log_window; public: tab_settings(wxWindow *parent);