editor/gtk: Disable landscape controls when necessary

Günther Brammer 2011-01-04 17:16:51 +01:00
parent f990fe7651
commit 5d0f6fb30b
5 changed files with 33 additions and 23 deletions

View File

@ -433,8 +433,9 @@ bool C4ConsoleGUI::DoUpdateHaltCtrls(bool fHalt)
return true;
}
void C4ConsoleGUI::ToolsDlgEnableControls(C4ToolsDlg *dlg)
void C4ToolsDlg::EnableControls()
{
NeedPreviewUpdate();
}
void C4ConsoleGUI::ClearInput()

View File

@ -1498,8 +1498,21 @@ void C4ConsoleGUI::SetInputFunctions(std::vector<char*>& functions)
{
}
void C4ConsoleGUI::ToolsDlgEnableControls(C4ToolsDlg* dlg)
void C4ToolsDlg::EnableControls()
{
int32_t iLandscapeMode=::Landscape.Mode;
gtk_widget_set_sensitive(state->brush, iLandscapeMode>=C4LSC_Static);
gtk_widget_set_sensitive(state->line, iLandscapeMode>=C4LSC_Static);
gtk_widget_set_sensitive(state->rect, iLandscapeMode>=C4LSC_Static);
gtk_widget_set_sensitive(state->fill, iLandscapeMode>=C4LSC_Exact);
gtk_widget_set_sensitive(state->picker, iLandscapeMode>=C4LSC_Static);
gtk_widget_set_sensitive(state->ift, iLandscapeMode>=C4LSC_Static);
gtk_widget_set_sensitive(state->no_ift, iLandscapeMode>=C4LSC_Static);
gtk_widget_set_sensitive(state->materials, (iLandscapeMode>=C4LSC_Static));
gtk_widget_set_sensitive(state->textures, iLandscapeMode >= C4LSC_Static && !SEqual(Material,C4TLS_MatSky));
gtk_widget_set_sensitive(state->scale, iLandscapeMode>=C4LSC_Static);
gtk_widget_set_sensitive(state->preview, iLandscapeMode>=C4LSC_Static);
NeedPreviewUpdate();
}
// GTK+ Callbacks

View File

@ -139,7 +139,6 @@ public:
void ToolsDlgInitMaterialCtrls(class C4ToolsDlg *dlg);
void ToolsDlgSetTexture(class C4ToolsDlg *dlg, const char *texture);
void ToolsDlgSetMaterial(class C4ToolsDlg *dlg, const char *material);
void ToolsDlgEnableControls(C4ToolsDlg *dlg);
void ToolsDlgSelectTexture(C4ToolsDlg *dlg, const char *texture);
void ToolsDlgSelectMaterial(C4ToolsDlg *dlg, const char *material);

View File

@ -1173,21 +1173,22 @@ void C4ToolsDlg::UpdateLandscapeModeCtrls()
SetWindowText(state->hDialog,LoadResStr(iMode==C4LSC_Dynamic ? "IDS_DLG_DYNAMIC" : iMode==C4LSC_Static ? "IDS_DLG_STATIC" : "IDS_DLG_EXACT"));
}
void C4ConsoleGUI::ToolsDlgEnableControls(C4ToolsDlg *dlg)
void C4ToolsDlg::EnableControls()
{
HWND hDialog = dlg->state->hDialog;
HWND hDialog = state->hDialog;
int32_t iLandscapeMode=::Landscape.Mode;
// Set bitmap buttons
SendDlgItemMessage(hDialog,IDC_BUTTONBRUSH,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? dlg->state->hbmBrush : dlg->state->hbmBrush2));
SendDlgItemMessage(hDialog,IDC_BUTTONLINE,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? dlg->state->hbmLine : dlg->state->hbmLine2));
SendDlgItemMessage(hDialog,IDC_BUTTONRECT,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? dlg->state->hbmRect : dlg->state->hbmRect2));
SendDlgItemMessage(hDialog,IDC_BUTTONFILL,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Exact) ? dlg->state->hbmFill : dlg->state->hbmFill2));
SendDlgItemMessage(hDialog,IDC_BUTTONPICKER,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? dlg->state->hbmPicker : dlg->state->hbmPicker2));
SendDlgItemMessage(hDialog,IDC_BUTTONIFT,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)dlg->state->hbmIFT);
SendDlgItemMessage(hDialog,IDC_BUTTONNOIFT,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)dlg->state->hbmNoIFT);
SendDlgItemMessage(hDialog,IDC_BUTTONMODEDYNAMIC,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)dlg->state->hbmDynamic);
SendDlgItemMessage(hDialog,IDC_BUTTONMODESTATIC,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)dlg->state->hbmStatic);
SendDlgItemMessage(hDialog,IDC_BUTTONMODEEXACT,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)dlg->state->hbmExact);
SendDlgItemMessage(hDialog,IDC_BUTTONBRUSH,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? state->hbmBrush : state->hbmBrush2));
SendDlgItemMessage(hDialog,IDC_BUTTONLINE,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? state->hbmLine : state->hbmLine2));
SendDlgItemMessage(hDialog,IDC_BUTTONRECT,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? state->hbmRect : state->hbmRect2));
SendDlgItemMessage(hDialog,IDC_BUTTONFILL,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Exact) ? state->hbmFill : state->hbmFill2));
SendDlgItemMessage(hDialog,IDC_BUTTONPICKER,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? state->hbmPicker : state->hbmPicker2));
SendDlgItemMessage(hDialog,IDC_BUTTONIFT,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)state->hbmIFT);
SendDlgItemMessage(hDialog,IDC_BUTTONNOIFT,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)state->hbmNoIFT);
SendDlgItemMessage(hDialog,IDC_BUTTONMODEDYNAMIC,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)state->hbmDynamic);
SendDlgItemMessage(hDialog,IDC_BUTTONMODESTATIC,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)state->hbmStatic);
SendDlgItemMessage(hDialog,IDC_BUTTONMODEEXACT,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)state->hbmExact);
// Enable drawing controls
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONBRUSH),(iLandscapeMode>=C4LSC_Static));
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONLINE),(iLandscapeMode>=C4LSC_Static));
@ -1197,11 +1198,13 @@ void C4ConsoleGUI::ToolsDlgEnableControls(C4ToolsDlg *dlg)
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONIFT),(iLandscapeMode>=C4LSC_Static));
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONNOIFT),(iLandscapeMode>=C4LSC_Static));
EnableWindow(GetDlgItem(hDialog,IDC_COMBOMATERIAL),(iLandscapeMode>=C4LSC_Static));
EnableWindow(GetDlgItem(hDialog,IDC_COMBOTEXTURE),(iLandscapeMode>=C4LSC_Static) && !SEqual(dlg->Material,C4TLS_MatSky));
EnableWindow(GetDlgItem(hDialog,IDC_COMBOTEXTURE),(iLandscapeMode>=C4LSC_Static) && !SEqual(Material,C4TLS_MatSky));
EnableWindow(GetDlgItem(hDialog,IDC_STATICMATERIAL),(iLandscapeMode>=C4LSC_Static));
EnableWindow(GetDlgItem(hDialog,IDC_STATICTEXTURE),(iLandscapeMode>=C4LSC_Static) && !SEqual(dlg->Material,C4TLS_MatSky));
EnableWindow(GetDlgItem(hDialog,IDC_STATICTEXTURE),(iLandscapeMode>=C4LSC_Static) && !SEqual(Material,C4TLS_MatSky));
EnableWindow(GetDlgItem(hDialog,IDC_SLIDERGRADE),(iLandscapeMode>=C4LSC_Static));
EnableWindow(GetDlgItem(hDialog,IDC_PREVIEW),(iLandscapeMode>=C4LSC_Static));
NeedPreviewUpdate();
}
#include "C4ConsoleGUICommon.h"

View File

@ -152,12 +152,6 @@ bool C4ToolsDlg::SetLandscapeMode(int32_t iMode, bool fThroughControl)
return true;
}
void C4ToolsDlg::EnableControls()
{
Console.ToolsDlgEnableControls(this);
NeedPreviewUpdate();
}
void C4ToolsDlg::AssertValidTexture()
{
// Static map mode only