forked from Mirrors/openclonk
editor: consolidate the four status text fields in one function
Only a very minor improvement in terms of lines-of-code, but still.
parent
511e835955
commit
8c2d2d3cc1
|
@ -134,9 +134,9 @@ void C4Console::DoHalt()
|
|||
Game.Pause();
|
||||
}
|
||||
|
||||
bool C4Console::UpdateStatusBars()
|
||||
void C4Console::UpdateStatusBars()
|
||||
{
|
||||
if (!Active) return false;
|
||||
if (!Active) return;
|
||||
// Frame counter
|
||||
if (Game.FrameCounter!=FrameCounter)
|
||||
{
|
||||
|
@ -162,7 +162,6 @@ bool C4Console::UpdateStatusBars()
|
|||
str.Format("%02d:%02d:%02d (%i FPS)",Time/3600,(Time%3600)/60,Time%60,FPS);
|
||||
C4ConsoleGUI::DisplayInfoText(CONSOLE_TimeFPS, str);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4Console::SaveGame(bool fSaveGame)
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
bool CloseGame();
|
||||
bool UpdatePlayerMenu();
|
||||
bool UpdateViewportMenu();
|
||||
bool UpdateStatusBars();
|
||||
void UpdateStatusBars();
|
||||
// Menu
|
||||
void ClearViewportMenu();
|
||||
void UpdateNetMenu();
|
||||
|
|
|
@ -627,9 +627,14 @@ void C4ConsoleGUI::State::Clear()
|
|||
|
||||
void C4ConsoleGUI::DisplayInfoText(InfoTextType type, StdStrBuf& text)
|
||||
{
|
||||
if (!Active)
|
||||
return;
|
||||
GtkWidget* label;
|
||||
switch (type)
|
||||
{
|
||||
case CONSOLE_Cursor:
|
||||
label = state->lblCursor;
|
||||
break;
|
||||
case CONSOLE_FrameCounter:
|
||||
label = state->lblFrame;
|
||||
break;
|
||||
|
@ -680,14 +685,6 @@ void C4ConsoleGUI::ShowAboutWithCopyright(StdStrBuf ©right)
|
|||
gtk_show_about_dialog(GTK_WINDOW(window), "name", C4ENGINECAPTION, "version", C4VERSION, "copyright", copyright.getData(), NULL);
|
||||
}
|
||||
|
||||
bool C4ConsoleGUI::UpdateCursorBar(const char *szCursor)
|
||||
{
|
||||
if (!Active)
|
||||
return false;
|
||||
gtk_label_set_label(GTK_LABEL(state->lblCursor), szCursor);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4ConsoleGUI::UpdateModeCtrls(int iMode)
|
||||
{
|
||||
if (!Active)
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
|
||||
enum InfoTextType
|
||||
{
|
||||
CONSOLE_Cursor,
|
||||
CONSOLE_FrameCounter,
|
||||
CONSOLE_ScriptCounter,
|
||||
CONSOLE_TimeFPS
|
||||
|
@ -90,7 +91,6 @@ public:
|
|||
void SetCursor(Cursor cursor);
|
||||
void RecordingEnabled();
|
||||
void ShowAboutWithCopyright(StdStrBuf ©right);
|
||||
bool UpdateCursorBar(const char *szCursor);
|
||||
bool UpdateModeCtrls(int iMode);
|
||||
void UpdateNetMenu(Stage stage);
|
||||
void ClearNetMenu(Stage stage);
|
||||
|
|
|
@ -728,9 +728,14 @@ void C4ConsoleGUI::SetCaptionToFileName(const char* file_name)
|
|||
|
||||
void C4ConsoleGUI::DisplayInfoText(C4ConsoleGUI::InfoTextType type, StdStrBuf& text)
|
||||
{
|
||||
if (!Active)
|
||||
return;
|
||||
int dialog_item;
|
||||
switch (type)
|
||||
{
|
||||
case CONSOLE_Cursor:
|
||||
dialog_item = IDC_STATICCURSOR;
|
||||
break;
|
||||
case CONSOLE_FrameCounter:
|
||||
dialog_item = IDC_STATICFRAME;
|
||||
break;
|
||||
|
@ -763,16 +768,6 @@ void C4ConsoleGUI::ShowAboutWithCopyright(StdStrBuf ©right)
|
|||
MessageBox(NULL, strMessage.getData(), C4ENGINECAPTION, MB_ICONINFORMATION | MB_TASKMODAL);
|
||||
}
|
||||
|
||||
bool C4ConsoleGUI::UpdateCursorBar(const char *szCursor)
|
||||
{
|
||||
if (!Active)
|
||||
return false;
|
||||
// Cursor
|
||||
SetDlgItemText(hWindow,IDC_STATICCURSOR,szCursor);
|
||||
UpdateWindow(GetDlgItem(hWindow,IDC_STATICCURSOR));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4ConsoleGUI::FileSelect(char *sFilename, int iSize, const char * szFilter, DWORD dwFlags, bool fSave)
|
||||
{
|
||||
OPENFILENAME ofn;
|
||||
|
|
|
@ -187,7 +187,7 @@ bool C4EditCursor::Move(float iX, float iY, WORD wKeyFlags)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool C4EditCursor::UpdateStatusBar()
|
||||
void C4EditCursor::UpdateStatusBar()
|
||||
{
|
||||
int32_t X=this->X, Y=this->Y;
|
||||
StdStrBuf str;
|
||||
|
@ -207,7 +207,7 @@ bool C4EditCursor::UpdateStatusBar()
|
|||
break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
}
|
||||
return Console.UpdateCursorBar(str.getData());
|
||||
Console.DisplayInfoText(C4ConsoleGUI::CONSOLE_Cursor, str);
|
||||
}
|
||||
|
||||
void C4EditCursor::OnSelectionChanged()
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
bool AltDown();
|
||||
bool AltUp();
|
||||
protected:
|
||||
bool UpdateStatusBar();
|
||||
void UpdateStatusBar();
|
||||
void ApplyToolPicker();
|
||||
void ToolFailure();
|
||||
void PutContents();
|
||||
|
|
Loading…
Reference in New Issue