OpenClonk
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

◆ GetWideLPARAM

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

Definition at line 40 of file C4ConsoleWin32.cpp.

Function Documentation

◆ AddMenuItem()

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

Definition at line 46 of file C4ConsoleWin32.cpp.

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 }
StdBuf GetWideCharBuf(const char *utf8)
std::enable_if< std::is_pod< T >::value >::type ZeroMem(T *lpMem, size_t dwSize)
Definition: Standard.h:60
bool Active
Definition: C4Window.h:274
Definition: StdBuf.h:30

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

Here is the call graph for this function:

◆ ConsoleDlgProc()

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

Definition at line 345 of file C4ConsoleWin32.cpp.

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 }
#define WM_USER_LOG
#define WM_USER_RELOADFILE
C4Config Config
Definition: C4Config.cpp:930
const int C4CNS_ModeDraw
Definition: C4Console.h:33
#define IDM_VIEWPORT_NEW2
Definition: C4Console.h:40
#define IDM_NET_CLIENT1
Definition: C4Console.h:35
const int C4CNS_ModePlay
Definition: C4Console.h:30
#define IDM_NET_CLIENT2
Definition: C4Console.h:36
#define IDM_VIEWPORT_NEW1
Definition: C4Console.h:39
#define IDM_PLAYER_QUIT1
Definition: C4Console.h:37
const int C4CNS_ModeEdit
Definition: C4Console.h:31
#define IDM_PLAYER_QUIT2
Definition: C4Console.h:38
C4GameControl Control
C4Game Game
Definition: C4Globals.cpp:52
C4Console Console
Definition: C4Globals.cpp:45
C4Application Application
Definition: C4Globals.cpp:44
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
bool Log(const char *szMessage)
Definition: C4Log.cpp:204
@ CID_PlrAction
Definition: C4PacketBase.h:166
C4PlayerList Players
C4ViewportList Viewports
bool SEqual2(const char *szStr1, const char *szStr2)
Definition: Standard.cpp:204
bool Inside(T ival, U lbound, V rbound)
Definition: Standard.h:43
bool Active
Definition: C4App.h:63
void OnKeyboardLayoutChanged() override
C4MusicSystem MusicSystem
Definition: C4Application.h:41
void Quit() override
C4Client * getClientByID(int32_t iID) const
Definition: C4Client.cpp:200
void CtrlRemove(const C4Client *pClient, const char *szReason)
Definition: C4Client.cpp:333
const char * GetSubkeyPath(const char *subkey)
Definition: C4Config.cpp:806
bool FileRecord()
Definition: C4Console.cpp:394
bool In(const char *szText)
Definition: C4Console.cpp:65
void Close() override
Definition: C4Console.cpp:437
void DoPlay()
Definition: C4Console.cpp:95
bool FileOpen(const char *filename=nullptr, bool host_in_network=false)
Definition: C4Console.cpp:319
@ MRU_Scenario
Definition: C4Console.h:98
void UpdateInputCtrl()
Definition: C4Console.cpp:481
void PlayerJoin()
Definition: C4Console.cpp:513
void HelpAbout()
Definition: C4Console.cpp:449
void DoHalt()
Definition: C4Console.cpp:100
void RegisterRecentInput(const char *input, RecentScriptInputLists section)
Definition: C4Console.cpp:639
C4EditCursor EditCursor
Definition: C4Console.h:90
bool FileOpenWPlrs()
Definition: C4Console.cpp:343
bool FileQuit()
Definition: C4Console.cpp:443
bool FileClose()
Definition: C4Console.cpp:382
bool FileSave()
Definition: C4Console.cpp:262
void ViewportNew()
Definition: C4Console.cpp:456
bool FileSaveAs(bool fSaveGame, bool export_packed=false)
Definition: C4Console.cpp:269
void Add(C4PacketType eType, C4ControlPacket *pCtrl)
Definition: C4Control.h:82
static C4ControlPlayerAction * Eliminate(const C4Player *source)
Definition: C4Control.cpp:564
bool SetMode(int32_t iMode)
C4Control Input
Definition: C4GameControl.h:66
bool isCtrlHost() const
Definition: C4GameControl.h:99
bool ReloadFile(const char *filepath)
Definition: C4Game.cpp:2465
C4ClientList & Clients
Definition: C4Game.h:69
C4Player * Get(int iPlayer) const
bool CreateViewport(int32_t player_nr, bool silent=false)
#define IDC_BUTTONPLAY
Definition: resource.h:37
#define IDC_BUTTONMODEPLAY
Definition: resource.h:34
#define IDM_FILE_CLOSE
Definition: resource.h:81
#define IDM_FILE_OPEN
Definition: resource.h:82
#define IDM_FILE_SAVE
Definition: resource.h:85
#define IDM_VIEWPORT_NEW
Definition: resource.h:93
#define IDM_PLAYER_JOIN
Definition: resource.h:89
#define IDM_FILE_SAVEAS
Definition: resource.h:86
#define IDM_FILE_QUIT
Definition: resource.h:84
#define IDC_BUTTONMODEEDIT
Definition: resource.h:32
#define IDC_BUTTONHALT
Definition: resource.h:28
#define IDM_FILE_OPENWPLRS
Definition: resource.h:83
#define IDM_FILE_RECORD
Definition: resource.h:98
#define IDC_COMBOINPUT
Definition: resource.h:40
#define IDM_HELP_ABOUT
Definition: resource.h:88
#define IDC_BUTTONMODEDRAW
Definition: resource.h:30
#define IDM_FILE_SAVEGAMEAS
Definition: resource.h:87

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.

Here is the call graph for this function:

◆ LoadResStrW()

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

Definition at line 42 of file C4ConsoleWin32.cpp.

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

References GetWideChar(), and LoadResStr().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PropertyDlgProc()

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

Definition at line 698 of file C4ConsoleWin32.cpp.

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 }
void PropertyDlgClose()
Definition: C4Console.cpp:686
bool In(const char *szText)
C4EditCursorSelection & GetSelection()
Definition: C4EditCursor.h:104
C4Object * GetObject(int32_t index=0) const
bool ReloadDef(C4ID id)
Definition: C4Game.cpp:2488
C4ID id
Definition: C4Object.h:106
#define IDC_BUTTONRELOADDEF
Definition: resource.h:39

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().

Here is the call graph for this function:

◆ SetMenuItemText()

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:

◆ ToolsDlgProc()

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

Definition at line 585 of file C4ConsoleWin32.cpp.

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 }
const int32_t C4TLS_Line
Definition: C4ToolsDlg.h:29
const int32_t C4TLS_Fill
Definition: C4ToolsDlg.h:31
const int32_t C4TLS_Rect
Definition: C4ToolsDlg.h:30
const int32_t C4TLS_GradeMax
Definition: C4ToolsDlg.h:35
const int32_t C4TLS_Brush
Definition: C4ToolsDlg.h:28
const int32_t C4TLS_Picker
Definition: C4ToolsDlg.h:32
uint16_t WORD
C4ToolsDlg ToolsDlg
Definition: C4Console.h:88
void SetBackMaterial(const char *szMaterial)
Definition: C4ToolsDlg.cpp:106
void SetBackTexture(const char *szTexture)
Definition: C4ToolsDlg.cpp:116
void SetMaterial(const char *szMaterial)
Definition: C4ToolsDlg.cpp:60
bool SetTool(int32_t iTool, bool fTemp)
Definition: C4ToolsDlg.cpp:43
void SetTexture(const char *szTexture)
Definition: C4ToolsDlg.cpp:71
void NeedPreviewUpdate()
Definition: C4Console.cpp:702
bool SetGrade(int32_t iGrade)
Definition: C4ToolsDlg.cpp:166
bool SetLandscapeMode(LandscapeMode iMode, bool flat_chunk_shapes, bool fThroughControl=false)
Definition: C4ToolsDlg.cpp:181
#define IDC_BUTTONMODEDYNAMIC
Definition: resource.h:31
#define IDC_COMBOFGTEXTURE
Definition: resource.h:42
#define IDC_SLIDERGRADE
Definition: resource.h:46
#define IDC_BUTTONRECT
Definition: resource.h:38
#define IDC_BUTTONLINE
Definition: resource.h:29
#define IDC_BUTTONMODEEXACT
Definition: resource.h:33
#define IDC_COMBOBGMATERIAL
Definition: resource.h:62
#define IDC_COMBOBGTEXTURE
Definition: resource.h:63
#define IDC_BUTTONPICKER
Definition: resource.h:36
#define IDC_BUTTONMODESTATIC
Definition: resource.h:35
#define IDC_BUTTONBRUSH
Definition: resource.h:26
#define IDC_COMBOFGMATERIAL
Definition: resource.h:41
#define IDC_BUTTONFILL
Definition: resource.h:27