OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4ConsoleWin32.cpp File Reference
#include "C4Include.h"
#include "editor/C4Console.h"
#include "platform/C4AppWin32Impl.h"
#include "editor/C4ConsoleGUI.h"
#include "graphics/C4DrawGL.h"
#include "landscape/C4Landscape.h"
#include "object/C4Object.h"
#include "player/C4PlayerList.h"
#include "landscape/C4Texture.h"
#include "C4Version.h"
#include "game/C4Viewport.h"
#include "platform/StdRegistry.h"
#include "lib/StdColors.h"
#include "landscape/C4Sky.h"
#include "platform/C4windowswrapper.h"
#include <mmsystem.h>
#include <commdlg.h>
#include "res/resource.h"
#include <commctrl.h>
#include "editor/C4ConsoleGUICommon.h"
Include dependency graph for C4ConsoleWin32.cpp:

Go to the source code of this file.

Classes

class  C4ConsoleGUI::State
 
class  C4ToolsDlg::State
 
class  C4ConsoleGUIPreviewWindow
 

Macros

#define GetWideLPARAM(c)   reinterpret_cast<LPARAM>(static_cast<wchar_t*>(GetWideChar(c)))
 

Functions

StdStrBuf::wchar_t_holder LoadResStrW (const char *id)
 
bool SetMenuItemText (HMENU hMenu, WORD id, const char *szText)
 
bool AddMenuItem (C4ConsoleGUI *console, HMENU hMenu, DWORD dwID, const char *szString, bool fEnabled)
 
INT_PTR CALLBACK ConsoleDlgProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK ToolsDlgProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK PropertyDlgProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
 

Macro Definition Documentation

#define GetWideLPARAM (   c)    reinterpret_cast<LPARAM>(static_cast<wchar_t*>(GetWideChar(c)))

Definition at line 40 of file C4ConsoleWin32.cpp.

Function Documentation

bool AddMenuItem ( C4ConsoleGUI console,
HMENU  hMenu,
DWORD  dwID,
const char *  szString,
bool  fEnabled 
)

Definition at line 46 of file C4ConsoleWin32.cpp.

References C4Window::Active, GetWideCharBuf(), and ZeroMem().

Referenced by InitObjectFunctionMap().

47 {
48  if (!console->Active) return false;
49  MENUITEMINFOW minfo;
50  ZeroMem(&minfo,sizeof(minfo));
51  minfo.cbSize = sizeof(minfo);
52  minfo.fMask = MIIM_ID | MIIM_TYPE | MIIM_DATA | MIIM_STATE;
53  minfo.fType = MFT_STRING;
54  minfo.wID = dwID;
55  StdBuf td = GetWideCharBuf(szString);
56  minfo.dwTypeData = getMBufPtr<wchar_t>(td);
57  minfo.cch = wcslen(minfo.dwTypeData);
58  if (!fEnabled) minfo.fState|=MFS_GRAYED;
59  return !!InsertMenuItemW(hMenu,0,false,&minfo);
60 }
Definition: StdBuf.h:37
StdBuf GetWideCharBuf(const char *utf8)
bool Active
Definition: C4Window.h:278
std::enable_if< std::is_pod< T >::value >::type ZeroMem(T *lpMem, size_t dwSize)
Definition: Standard.h:63

Here is the call graph for this function:

Here is the caller graph for this function:

INT_PTR CALLBACK ConsoleDlgProc ( HWND  hDlg,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 345 of file C4ConsoleWin32.cpp.

References C4AbstractApp::Active, C4Window::Active, C4Control::Add(), Application, C4CNS_ModeDraw, C4CNS_ModeEdit, C4CNS_ModePlay, CID_PlrAction, C4Game::Clients, C4Console::Close(), Config, Console, Control, C4ViewportList::CreateViewport(), C4ClientList::CtrlRemove(), C4Console::DoHalt(), C4Console::DoPlay(), C4Console::EditCursor, C4ControlPlayerAction::Eliminate(), C4Console::FileClose(), C4Console::FileOpen(), C4Console::FileOpenWPlrs(), C4Console::FileQuit(), C4Console::FileRecord(), C4Console::FileSave(), C4Console::FileSaveAs(), Game, C4PlayerList::Get(), C4ClientList::getClientByID(), StdStrBuf::getData(), C4Config::GetSubkeyPath(), C4Console::HelpAbout(), IDC_BUTTONHALT, IDC_BUTTONMODEDRAW, IDC_BUTTONMODEEDIT, IDC_BUTTONMODEPLAY, IDC_BUTTONPLAY, IDC_COMBOINPUT, IDM_FILE_CLOSE, IDM_FILE_OPEN, IDM_FILE_OPENWPLRS, IDM_FILE_QUIT, IDM_FILE_RECORD, IDM_FILE_SAVE, IDM_FILE_SAVEAS, IDM_FILE_SAVEGAMEAS, IDM_HELP_ABOUT, IDM_NET_CLIENT1, IDM_NET_CLIENT2, IDM_PLAYER_JOIN, IDM_PLAYER_QUIT1, IDM_PLAYER_QUIT2, IDM_VIEWPORT_NEW, IDM_VIEWPORT_NEW1, IDM_VIEWPORT_NEW2, C4Console::In(), C4GameControl::Input, Inside(), C4GameControl::isCtrlHost(), LoadResStr(), Log(), C4Console::MRU_Scenario, C4Application::MusicSystem, C4MusicSystem::NotifySuccess(), C4Application::OnKeyboardLayoutChanged(), C4Console::PlayerJoin(), Players, C4Application::Quit(), C4Console::RegisterRecentInput(), C4Game::ReloadFile(), SEqual2(), C4EditCursor::SetMode(), C4Console::UpdateInputCtrl(), C4Console::ViewportNew(), Viewports, WM_USER_LOG, and WM_USER_RELOADFILE.

346 {
347  switch (Msg)
348  {
349  //------------------------------------------------------------------------------------------------------------
350  case WM_ACTIVATEAPP:
351  Application.Active = wParam != 0;
352  return true;
353  //------------------------------------------------------------------------------------------------------------
354  case WM_DESTROY:
355  StoreWindowPosition(hDlg, "Main", Config.GetSubkeyPath("Console"), true);
356  Application.Quit();
357  return true;
358  //------------------------------------------------------------------------------------------------------------
359  case WM_CLOSE:
360  Console.Close();
361  return true;
362  //------------------------------------------------------------------------------------------------------------
363  case MM_MCINOTIFY:
364  if (wParam == MCI_NOTIFY_SUCCESSFUL)
366  return true;
367  //------------------------------------------------------------------------------------------------------------
368  case WM_INITDIALOG:
369  Console.Active = true;
370  SendMessage(hDlg, DM_SETDEFID, (WPARAM)IDOK, (LPARAM)0);
371  Console.UpdateMenuText(GetMenu(hDlg));
372  return true;
373  //------------------------------------------------------------------------------------------------------------
374  case WM_COMMAND:
375  // Evaluate command
376  switch (LOWORD(wParam))
377  {
378  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
379  case IDOK:
380  // IDC_COMBOINPUT to Console.In()
381  wchar_t buffer[16000];
382  GetDlgItemTextW(hDlg, IDC_COMBOINPUT, buffer, 16000);
383  if (buffer[0])
384  {
385  StdStrBuf in_char(buffer);
387  ::Console.In(in_char.getData());
389  }
390  return true;
391  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
392  case IDC_BUTTONHALT:
393  Console.DoHalt();
394  return true;
395  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
396  case IDC_BUTTONPLAY:
397  Console.DoPlay();
398  return true;
399  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
400  case IDC_BUTTONMODEPLAY:
402  return true;
403  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
404  case IDC_BUTTONMODEEDIT:
406  return true;
407  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
408  case IDC_BUTTONMODEDRAW:
410  return true;
411  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
412  case IDM_FILE_QUIT: Console.FileQuit(); return true;
413  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
414  case IDM_FILE_SAVEAS: Console.FileSaveAs(false); return true;
415  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
416  case IDM_FILE_SAVE: Console.FileSave(); return true;
417  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
418  case IDM_FILE_SAVEGAMEAS: Console.FileSaveAs(true); return true;
419  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
420  case IDM_FILE_OPEN: Console.FileOpen(); return true;
421  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
422  case IDM_FILE_RECORD: Console.FileRecord(); return true;
423  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
424  case IDM_FILE_OPENWPLRS: Console.FileOpenWPlrs(); return true;
425  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
426  case IDM_FILE_CLOSE: Console.FileClose(); return true;
427  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
428  case IDM_HELP_ABOUT: Console.HelpAbout(); return true;
429  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
430  case IDM_PLAYER_JOIN: Console.PlayerJoin(); return true;
431  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
432  case IDM_VIEWPORT_NEW: Console.ViewportNew(); return true;
433  }
434  // New player viewport
435  if (Inside((int)LOWORD(wParam), IDM_VIEWPORT_NEW1, IDM_VIEWPORT_NEW2))
436  {
437  ::Viewports.CreateViewport(LOWORD(wParam) - IDM_VIEWPORT_NEW1);
438  return true;
439  }
440  // Remove player
441  if (Inside((int)LOWORD(wParam), IDM_PLAYER_QUIT1, IDM_PLAYER_QUIT2))
442  {
443  C4Player *plr = ::Players.Get(LOWORD(wParam) - IDM_PLAYER_QUIT1);
444  if (!plr) return true;
446  return true;
447  }
448  // Remove client
449  if (Inside((int)LOWORD(wParam), IDM_NET_CLIENT1, IDM_NET_CLIENT2))
450  {
451  if (!::Control.isCtrlHost()) return false;
452  Game.Clients.CtrlRemove(Game.Clients.getClientByID(LOWORD(wParam) - IDM_NET_CLIENT1), LoadResStr("IDS_MSG_KICKBYMENU"));
453  return true;
454  }
455  return false;
456  //------------------------------------------------------------------------------------------------------------
457  case WM_USER_LOG:
458  if (SEqual2((const char *)lParam, "IDS_"))
459  Log(LoadResStr((const char *)lParam));
460  else
461  Log((const char *)lParam);
462  return false;
463  //------------------------------------------------------------------------------------------------------------
464  case WM_COPYDATA:
465  {
466  COPYDATASTRUCT* pcds = reinterpret_cast<COPYDATASTRUCT *>(lParam);
467  if (pcds->dwData == WM_USER_RELOADFILE)
468  {
469  // get path, ensure proper termination
470  const char *szPath = reinterpret_cast<const char *>(pcds->lpData);
471  if (szPath[pcds->cbData - 1]) break;
472  // reload
473  Game.ReloadFile(szPath);
474  }
475  return false;
476  }
477  //------------------------------------------------------------------------------------------------------------
478  case WM_INPUTLANGCHANGE:
480  break;
481  //------------------------------------------------------------------------------------------------------------
482  // Resizing
483  case WM_GETMINMAXINFO:
484  // Window may not become smaller than initial size
485  if (Console.state && Console.state->console_default_width)
486  {
487  MINMAXINFO *info = reinterpret_cast<MINMAXINFO *>(lParam);
488  info->ptMinTrackSize.x = Console.state->console_default_width;
489  info->ptMinTrackSize.y = Console.state->console_default_height;
490  }
491  return 0;
492  case WM_SIZING: Console.state->ConsoleUpdateSize(); break;
493  case WM_WINDOWPOSCHANGED:
494  {
495  const WINDOWPOS *data = reinterpret_cast<const WINDOWPOS *>(lParam);
496  if (data && !(data->flags & SWP_NOSIZE)) Console.state->ConsoleUpdateSize();
497  break;
498  }
499  }
500  return false;
501 }
bool FileSaveAs(bool fSaveGame, bool export_packed=false)
Definition: C4Console.cpp:274
C4EditCursor EditCursor
Definition: C4Console.h:90
#define IDM_NET_CLIENT2
Definition: C4Console.h:36
C4Config Config
Definition: C4Config.cpp:837
bool SetMode(int32_t iMode)
#define WM_USER_RELOADFILE
C4Console Console
Definition: C4Globals.cpp:45
#define IDM_FILE_QUIT
Definition: resource.h:84
bool isCtrlHost() const
Definition: C4GameControl.h:99
C4Game Game
Definition: C4Globals.cpp:52
void HelpAbout()
Definition: C4Console.cpp:454
const char * GetSubkeyPath(const char *strSubkey)
Definition: C4Config.cpp:717
void Add(C4PacketType eType, C4ControlPacket *pCtrl)
Definition: C4Control.h:82
#define IDC_BUTTONPLAY
Definition: resource.h:37
void RegisterRecentInput(const char *input, RecentScriptInputLists section)
Definition: C4Console.cpp:644
#define IDM_PLAYER_QUIT1
Definition: C4Console.h:37
void DoHalt()
Definition: C4Console.cpp:105
#define IDM_PLAYER_QUIT2
Definition: C4Console.h:38
#define WM_USER_LOG
#define IDM_FILE_SAVEGAMEAS
Definition: resource.h:87
virtual void OnKeyboardLayoutChanged()
bool FileClose()
Definition: C4Console.cpp:387
const int C4CNS_ModeEdit
Definition: C4Console.h:31
#define IDM_PLAYER_JOIN
Definition: resource.h:89
void CtrlRemove(const C4Client *pClient, const char *szReason)
Definition: C4Client.cpp:350
#define IDM_NET_CLIENT1
Definition: C4Console.h:35
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
#define IDM_VIEWPORT_NEW2
Definition: C4Console.h:40
#define IDM_FILE_OPEN
Definition: resource.h:82
void UpdateInputCtrl()
Definition: C4Console.cpp:486
C4Player * Get(int iPlayer) const
#define IDM_VIEWPORT_NEW
Definition: resource.h:93
#define IDC_BUTTONMODEDRAW
Definition: resource.h:30
virtual void Quit()
bool Active
Definition: C4App.h:63
#define IDM_FILE_OPENWPLRS
Definition: resource.h:83
void DoPlay()
Definition: C4Console.cpp:100
C4GameControl Control
static C4ControlPlayerAction * Eliminate(const C4Player *source)
Definition: C4Control.cpp:574
#define IDM_HELP_ABOUT
Definition: resource.h:88
const int C4CNS_ModePlay
Definition: C4Console.h:30
C4Control Input
Definition: C4GameControl.h:66
C4PlayerList Players
void ViewportNew()
Definition: C4Console.cpp:461
const int C4CNS_ModeDraw
Definition: C4Console.h:33
bool ReloadFile(const char *szPath)
Definition: C4Game.cpp:2002
bool In(const char *szText)
Definition: C4Console.cpp:70
bool CreateViewport(int32_t iPlayer, bool fSilent=false)
Definition: C4Viewport.cpp:920
bool FileOpenWPlrs()
Definition: C4Console.cpp:348
#define IDM_FILE_SAVE
Definition: resource.h:85
bool FileRecord()
Definition: C4Console.cpp:399
bool FileOpen(const char *filename=nullptr, bool host_in_network=false)
Definition: C4Console.cpp:324
#define IDM_FILE_SAVEAS
Definition: resource.h:86
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
C4Client * getClientByID(int32_t iID) const
Definition: C4Client.cpp:217
#define IDM_VIEWPORT_NEW1
Definition: C4Console.h:39
#define IDC_BUTTONMODEEDIT
Definition: resource.h:32
#define IDC_COMBOINPUT
Definition: resource.h:40
#define IDC_BUTTONHALT
Definition: resource.h:28
bool Active
Definition: C4Window.h:278
bool Log(const char *szMessage)
Definition: C4Log.cpp:195
bool FileSave()
Definition: C4Console.cpp:267
bool SEqual2(const char *szStr1, const char *szStr2)
Definition: Standard.cpp:175
C4ClientList & Clients
Definition: C4Game.h:71
bool FileQuit()
Definition: C4Console.cpp:448
#define IDC_BUTTONMODEPLAY
Definition: resource.h:34
#define IDM_FILE_CLOSE
Definition: resource.h:81
virtual void Close()
Definition: C4Console.cpp:442
bool Inside(T ival, U lbound, V rbound)
Definition: Standard.h:45
#define IDM_FILE_RECORD
Definition: resource.h:98
C4Application Application
Definition: C4Globals.cpp:44
void PlayerJoin()
Definition: C4Console.cpp:518
C4MusicSystem MusicSystem
Definition: C4Application.h:41

Here is the call graph for this function:

StdStrBuf::wchar_t_holder LoadResStrW ( const char *  id)
inline

Definition at line 42 of file C4ConsoleWin32.cpp.

References GetWideChar(), and LoadResStr().

Referenced by C4ConsoleGUI::State::UpdateMenuText().

42 { return GetWideChar(LoadResStr(id)); }
StdStrBuf::wchar_t_holder GetWideChar(const char *utf8, bool double_null_terminate=false)
const char * LoadResStr(const char *id)
Definition: C4Language.h:83

Here is the call graph for this function:

Here is the caller graph for this function:

INT_PTR CALLBACK PropertyDlgProc ( HWND  hDlg,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 698 of file C4ConsoleWin32.cpp.

References Config, Console, C4Console::EditCursor, Game, C4EditCursorSelection::GetObject(), C4EditCursor::GetSelection(), C4Config::GetSubkeyPath(), C4Object::id, IDC_BUTTONRELOADDEF, IDC_COMBOINPUT, C4EditCursor::In(), C4ConsoleGUI::PropertyDlgClose(), and C4Game::ReloadDef().

699 {
700  switch (Msg)
701  {
702  //------------------------------------------------------------------------------------------------
703  case WM_CLOSE:
705  break;
706  //------------------------------------------------------------------------------------------------
707  case WM_DESTROY:
708  StoreWindowPosition(hDlg, "Property", Config.GetSubkeyPath("Console"), true);
709  break;
710  //------------------------------------------------------------------------------------------------
711  case WM_INITDIALOG:
712  SendMessage(hDlg,DM_SETDEFID,(WPARAM)IDOK,(LPARAM)0);
713  return true;
714  //------------------------------------------------------------------------------------------------
715  // Callbacks during/after window resizing
716  case WM_SIZING: Console.state->PropertyDlgUpdateSize(); break;
717  case WM_WINDOWPOSCHANGED:
718  {
719  const WINDOWPOS *data = reinterpret_cast<const WINDOWPOS *>(lParam);
720  if (data && !(data->flags & SWP_NOSIZE)) Console.state->PropertyDlgUpdateSize();
721  break;
722  }
723  //------------------------------------------------------------------------------------------------
724  case WM_COMMAND:
725  // Evaluate command
726  switch (LOWORD(wParam))
727  {
728  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
729  case IDOK:
730  // IDC_COMBOINPUT to Console.EditCursor.In()
731  wchar_t buffer[16000];
732  GetDlgItemTextW(hDlg,IDC_COMBOINPUT,buffer,16000);
733  if (buffer[0])
734  Console.EditCursor.In(StdStrBuf(buffer).getData());
735  return true;
736  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
737  case IDC_BUTTONRELOADDEF:
738  {
740  if (pObj)
741  Game.ReloadDef(pObj->id);
742  return true;
743  }
744  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
745  }
746  return false;
747  //-----------------------------------------------------------------------------------------------
748  }
749  return false;
750 }
C4EditCursor EditCursor
Definition: C4Console.h:90
C4Config Config
Definition: C4Config.cpp:837
C4ID id
Definition: C4Object.h:108
bool In(const char *szText)
C4Console Console
Definition: C4Globals.cpp:45
C4Game Game
Definition: C4Globals.cpp:52
const char * GetSubkeyPath(const char *strSubkey)
Definition: C4Config.cpp:717
C4EditCursorSelection & GetSelection()
Definition: C4EditCursor.h:105
C4Object * GetObject(int32_t index=0) const
bool ReloadDef(C4ID id)
Definition: C4Game.cpp:2019
#define IDC_COMBOINPUT
Definition: resource.h:40
#define IDC_BUTTONRELOADDEF
Definition: resource.h:39
void PropertyDlgClose()
Definition: C4Console.cpp:691

Here is the call graph for this function:

bool SetMenuItemText ( HMENU  hMenu,
WORD  id,
const char *  szText 
)

Referenced by C4EditCursor::DoContextMenu(), and C4ConsoleGUI::State::UpdateMenuText().

Here is the caller graph for this function:

INT_PTR CALLBACK ToolsDlgProc ( HWND  hDlg,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 585 of file C4ConsoleWin32.cpp.

References C4TLS_Brush, C4TLS_Fill, C4TLS_GradeMax, C4TLS_Line, C4TLS_Picker, C4TLS_Rect, C4ToolsDlg::Clear(), Config, Console, Dynamic, Exact, StdStrBuf::getData(), C4Config::GetSubkeyPath(), IDC_BUTTONBRUSH, IDC_BUTTONFILL, IDC_BUTTONLINE, IDC_BUTTONMODEDYNAMIC, IDC_BUTTONMODEEXACT, IDC_BUTTONMODESTATIC, IDC_BUTTONPICKER, IDC_BUTTONRECT, IDC_COMBOBGMATERIAL, IDC_COMBOBGTEXTURE, IDC_COMBOFGMATERIAL, IDC_COMBOFGTEXTURE, IDC_SLIDERGRADE, C4ToolsDlg::NeedPreviewUpdate(), C4ToolsDlg::SetBackMaterial(), C4ToolsDlg::SetBackTexture(), C4ToolsDlg::SetGrade(), C4ToolsDlg::SetLandscapeMode(), C4ToolsDlg::SetMaterial(), C4ToolsDlg::SetTexture(), C4ToolsDlg::SetTool(), Static, and C4Console::ToolsDlg.

586 {
587  int32_t iValue;
588  switch (Msg)
589  {
590  //----------------------------------------------------------------------------------------------
591  case WM_CLOSE:
593  break;
594  //----------------------------------------------------------------------------------------------
595  case WM_DESTROY:
596  StoreWindowPosition(hDlg, "Tools", Config.GetSubkeyPath("Console"), false);
597  break;
598  //----------------------------------------------------------------------------------------------
599  case WM_INITDIALOG:
600  return true;
601  //----------------------------------------------------------------------------------------------
602  case WM_PAINT:
603  PostMessage(hDlg,WM_USER,0,0); // For user paint
604  return false;
605  //----------------------------------------------------------------------------------------------
606  case WM_USER:
608  return true;
609  //----------------------------------------------------------------------------------------------
610  case WM_VSCROLL:
611  switch (LOWORD(wParam))
612  {
613  case SB_THUMBTRACK: case SB_THUMBPOSITION:
614  iValue=HIWORD(wParam);
616  break;
617  case SB_PAGEUP: case SB_PAGEDOWN:
618  case SB_LINEUP: case SB_LINEDOWN:
619  iValue=SendDlgItemMessage(hDlg,IDC_SLIDERGRADE,TBM_GETPOS,0,0);
621  break;
622  }
623  return true;
624  //----------------------------------------------------------------------------------------------
625  case WM_COMMAND:
626  // Evaluate command
627  switch (LOWORD(wParam))
628  {
629  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
630  case IDOK:
631  return true;
632  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
635  return true;
636  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
639  return true;
640  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
641  case IDC_BUTTONMODEEXACT:
643  return true;
644  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
645  case IDC_BUTTONBRUSH:
647  return true;
648  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
649  case IDC_BUTTONLINE:
651  return true;
652  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
653  case IDC_BUTTONRECT:
655  return true;
656  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
657  case IDC_BUTTONFILL:
659  return true;
660  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
661  case IDC_BUTTONPICKER:
663  return true;
664  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
667  switch (HIWORD(wParam))
668  {
669  case CBN_SELCHANGE:
670  {
671  // New material or texture selected. Get selection string
672  wchar_t str[100];
673  WORD idCombo = LOWORD(wParam);
674  int32_t cursel = SendDlgItemMessage(hDlg, idCombo, CB_GETCURSEL, 0, 0);
675  SendDlgItemMessage(hDlg, idCombo, CB_GETLBTEXT, cursel, (LPARAM)str);
676  // Convert to ascii
677  StdStrBuf str_buf(str);
678  const char *astr = str_buf.getData();
679  // Update appropriate setting in drawing tool
680  switch (idCombo)
681  {
682  case IDC_COMBOFGMATERIAL: Console.ToolsDlg.SetMaterial(astr); break;
683  case IDC_COMBOFGTEXTURE: Console.ToolsDlg.SetTexture(astr); break;
686  }
687  }
688  return true;
689  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
690  }
691  }
692  return false;
693  //----------------------------------------------------------------------------------------
694  }
695  return false;
696 }
#define IDC_BUTTONRECT
Definition: resource.h:38
C4Config Config
Definition: C4Config.cpp:837
#define IDC_COMBOBGMATERIAL
Definition: resource.h:62
bool SetGrade(int32_t iGrade)
Definition: C4ToolsDlg.cpp:165
C4Console Console
Definition: C4Globals.cpp:45
const char * GetSubkeyPath(const char *strSubkey)
Definition: C4Config.cpp:717
C4ToolsDlg ToolsDlg
Definition: C4Console.h:88
#define IDC_BUTTONFILL
Definition: resource.h:27
#define IDC_COMBOBGTEXTURE
Definition: resource.h:63
void SetTexture(const char *szTexture)
Definition: C4ToolsDlg.cpp:70
#define IDC_BUTTONPICKER
Definition: resource.h:36
const int32_t C4TLS_Rect
Definition: C4ToolsDlg.h:30
const int32_t C4TLS_Picker
Definition: C4ToolsDlg.h:32
#define IDC_BUTTONMODEEXACT
Definition: resource.h:33
const int32_t C4TLS_GradeMax
Definition: C4ToolsDlg.h:35
void SetBackMaterial(const char *szMaterial)
Definition: C4ToolsDlg.cpp:105
#define IDC_BUTTONLINE
Definition: resource.h:29
bool SetLandscapeMode(LandscapeMode iMode, bool flat_chunk_shapes, bool fThroughControl=false)
Definition: C4ToolsDlg.cpp:180
void NeedPreviewUpdate()
Definition: C4Console.cpp:707
const int32_t C4TLS_Brush
Definition: C4ToolsDlg.h:28
#define IDC_BUTTONBRUSH
Definition: resource.h:26
void SetBackTexture(const char *szTexture)
Definition: C4ToolsDlg.cpp:115
#define IDC_BUTTONMODESTATIC
Definition: resource.h:35
#define IDC_COMBOFGTEXTURE
Definition: resource.h:42
const int32_t C4TLS_Fill
Definition: C4ToolsDlg.h:31
#define IDC_SLIDERGRADE
Definition: resource.h:46
#define IDC_BUTTONMODEDYNAMIC
Definition: resource.h:31
const int32_t C4TLS_Line
Definition: C4ToolsDlg.h:29
#define IDC_COMBOFGMATERIAL
Definition: resource.h:41
bool SetTool(int32_t iTool, bool fTemp)
Definition: C4ToolsDlg.cpp:42
uint16_t WORD
void SetMaterial(const char *szMaterial)
Definition: C4ToolsDlg.cpp:59

Here is the call graph for this function: