32 #include "C4Version.h"
39 state->HideWelcomeScreen();
51 if (
Active) state->SetRecording(
true);
56 QMessageBox::about(state->window.get(), QString(
LoadResStr(
"IDS_MENU_ABOUT")), QString(copyright.
getData()));
62 state->SetEditCursorMode(iMode);
68 if (
Active) state->SetNetEnabled(
true);
73 if (
Active) state->ClearNetMenu();
78 if (
Active) state->AddNetMenuItem(client_id,
text, op);
83 if (
Active) state->ClearPlayerMenu();
88 if (
Active) state->SetInputFunctions(functions);
93 if (!state->CreateConsoleWindow(application))
return false;
104 state->DeleteConsoleWindow();
111 if (state->window.get())
114 state->ui.logView->append(QString(message));
116 QScrollBar *sb = state->ui.logView->verticalScrollBar();
117 if (sb) sb->setValue(sb->maximum());
125 if (!
Active)
return false;
126 state->ui.logView->clear();
132 QLabel *target =
nullptr;
140 target->setText(
text.getData());
148 QString filter=
"", selected_filter, filename;
154 if (filter.length() > 0) filter.append(
";;");
155 filter.append(szFilter);
156 szFilter += strlen(szFilter) + 1;
160 filter.append(szFilter);
162 szFilter += strlen(szFilter) + 1;
164 if (selected_filter.length() <= 0) selected_filter = filter;
167 #ifdef USE_WIN32_WINDOWS
169 size_t l = GetCurrentDirectoryW(0,
nullptr);
170 std::unique_ptr<wchar_t []> wd(
new wchar_t[l]);
171 GetCurrentDirectoryW(l, wd.get());
175 filename = QFileDialog::getSaveFileName(state->window.get(),
LoadResStr(
"IDS_DLG_SAVE"), QString(sFilename->
getData()), filter, &selected_filter);
177 filename = QFileDialog::getOpenFileName(state->window.get(),
LoadResStr(
"IDS_DLG_OPEN"), QString(), filter);
179 filenames = QFileDialog::getOpenFileNames(state->window.get(),
LoadResStr(
"IDS_DLG_OPEN"), QString(), filter, &selected_filter);
180 #ifdef USE_WIN32_WINDOWS
182 SetCurrentDirectoryW(wd.get());
188 if (!filenames.length())
return false;
189 for (
auto fn : filenames)
191 sFilename->
Append(fn.toUtf8());
197 if (filename.length() <= 0)
return false;
199 sFilename->
Copy(filename.toUtf8());
219 if (
Active) state->ClearViewportMenu();
240 state->SetEnabled(fEnable);
243 if (!fEnable) state->translation_overview_dialogue.reset();
249 if (!
Active)
return false;
250 state->ui.actionPlay->setChecked(!fHalt);
251 state->ui.actionPause->setChecked(fHalt);
260 if (
Active) state->PropertyDlgUpdate(rSelection, force_function_update);
271 if (state->ui.foregroundMatTexComboBox->count())
return;
272 state->ui.foregroundMatTexComboBox->clear();
273 state->ui.foregroundMatTexComboBox->addItem(QString(
C4TLS_MatSky));
281 if (strcmp(material_name,
"Vehicle") && strcmp(material_name,
"HalfVehicle"))
288 for (QString &item : items) state->ui.foregroundMatTexComboBox->addItem(item);
290 state->ui.foregroundMatTexComboBox->view()->setMinimumWidth(width);
291 state->ui.foregroundMatTexComboBox->setFixedWidth(width);
293 state->ui.backgroundMatTexComboBox->addItem(QString(
C4TLS_MatSky));
302 if (strcmp(material_name,
"Vehicle") && strcmp(material_name,
"HalfVehicle") && mat->
Density ==
C4M_Background)
309 for (QString &item : items) state->ui.backgroundMatTexComboBox->addItem(item);
310 state->ui.backgroundMatTexComboBox->addItem(QString(
"----------"));
319 if (strcmp(material_name,
"Vehicle") && strcmp(material_name,
"HalfVehicle") && mat->
Density !=
C4M_Background)
326 for (QString &item : items) state->ui.backgroundMatTexComboBox->addItem(item);
327 state->ui.backgroundMatTexComboBox->view()->setMinimumWidth(width);
328 state->ui.backgroundMatTexComboBox->setFixedWidth(width);
331 state->SetTexture(dlg->
Texture);
334 state->UpdateMatTex();
335 state->UpdateBackMatTex();
343 #ifdef USE_WIN32_WINDOWS
344 void C4ConsoleGUI::Win32KeepDialogsFloating(HWND hwnd) { }
345 bool C4ConsoleGUI::Win32DialogMessageHandling(MSG *msg) {
return false; }
346 void C4ConsoleGUI::UpdateMenuText(HMENU hMenu) { }
352 state->AddViewport(cvp);
358 state->RemoveViewport(cvp);
363 #ifdef WITH_QT_EDITOR
364 return state->CreateNewScenario(out_filename, out_host_as_network);
374 state->SetObjectSelection(selection);
377 void C4ConsoleGUI::ClearGamePointers()
379 state->ClearGamePointers();
384 state->definition_list_model->EnsureInit();
389 if (state && state->window) state->window->close();
394 if (state && state->object_list_model) state->object_list_model->Invalidate();
399 if (state && state->property_model)
401 const char *path = control->
GetPath();
407 C4ConsoleQtGraph::EditGraphValue(graph_value, control->
GetAction(), control->
GetIndex(), control->
GetX(), control->
GetY());
411 C4ConsoleQtShape *shape = state->property_model->GetShapeByPropertyPath(path);
414 C4ConsoleQtGraph *shape_graph = shape->GetGraphShape();
444 ::Console.state->ui.foregroundMatTexComboBox->setFocus();
445 ::Console.state->ui.foregroundMatTexComboBox->showPopup();
453 ::Console.state->ui.foregroundMatTexComboBox->setFocus();
454 ::Console.state->ui.foregroundMatTexComboBox->showPopup();
const int32_t C4M_Background
C4AulScriptEngine ScriptEngine
const char * LoadResStr(const char *id)
StdStrBuf FormatString(const char *szFmt,...)
C4Value DirectExec(C4PropList *p, const char *szScript, const char *szContext, bool fPassErrors=false, C4AulScriptContext *context=nullptr, bool parse_function=false)
C4PropListStatic * GetPropList()
void AddKickPlayerMenuItem(C4Player *player, StdStrBuf &player_text, bool enabled)
void EditGraphControl(const class C4ControlEditGraph *control)
void SetCursor(Cursor cursor)
void EnsureDefinitionListInitialized()
void EnableControls(bool fEnable)
void ToolsDlgSelectBackMaterial(C4ToolsDlg *dlg, const char *material)
void OnObjectSelectionChanged(class C4EditCursorSelection &selection)
void SetCaptionToFileName(const char *file_name)
void DoEnableControls(bool fEnable)
void AddMenuItemForPlayer(C4Player *player, StdStrBuf &player_text)
void DeleteConsoleWindow()
void CloseConsoleWindow()
bool CreateNewScenario(StdStrBuf *out_filename, bool *out_host_as_network)
bool FileSelect(StdStrBuf *sFilename, const char *szFilter, DWORD dwFlags, bool fSave)
void AddNetMenuItemForPlayer(int32_t client_id, const char *text, C4ConsoleGUI::ClientOperation co)
void AddViewport(C4ViewportWindow *cvp)
bool UpdateModeCtrls(int iMode)
bool CreateConsoleWindow(C4AbstractApp *application)
void ClearPointers(class C4Object *obj)
void Out(const char *message)
void RemoveViewport(C4ViewportWindow *cvp)
void ToolsDlgSelectMaterial(C4ToolsDlg *dlg, const char *material)
void ShowAboutWithCopyright(StdStrBuf ©right)
void PropertyDlgUpdate(class C4EditCursorSelection &rSelection, bool force_function_update)
bool ToolsDlgOpen(class C4ToolsDlg *dlg)
void SetInputFunctions(std::list< const char * > &functions)
void DisplayInfoText(InfoTextType type, StdStrBuf &text)
bool DoUpdateHaltCtrls(bool fHalt)
bool Message(const char *message, bool query)
void ToolsDlgSelectTexture(C4ToolsDlg *dlg, const char *texture)
void ToolsDlgSelectBackTexture(C4ToolsDlg *dlg, const char *texture)
void ToolsDlgInitMaterialCtrls(class C4ToolsDlg *dlg)
DECLARE_C4CONTROL_VIRTUALS const char * GetPath() const
bool LocalControl() const
LandscapeMode GetMode() const
const char * GetTextureName() const
C4Material * GetMaterial() const
const char * GetMaterialName() const
const C4TexMapEntry * GetEntry(int32_t iIndex) const
const char * getData() const
void AppendChar(char cChar)
void Append(const char *pnData, size_t iChars)
const DWORD OFN_ALLOWMULTISELECT