OpenClonk
C4ToolsDlg::State Class Reference
Inheritance diagram for C4ToolsDlg::State:
[legend]
Collaboration diagram for C4ToolsDlg::State:
[legend]

Public Member Functions

 State (C4ToolsDlg *dlg)
 
void Clear ()
 
void Default ()
 
 State (C4ToolsDlg *toolsDlg)
 
void LoadBitmaps (HINSTANCE instance)
 
 ~State ()
 
void Clear ()
 
void Default ()
 
class C4ToolsDlgGetOwner ()
 

Public Attributes

HWND hDialog
 
C4WindowpPreviewWindow
 
HBITMAP hbmBrush
 
HBITMAP hbmBrush2
 
HBITMAP hbmLine
 
HBITMAP hbmLine2
 
HBITMAP hbmRect
 
HBITMAP hbmRect2
 
HBITMAP hbmFill
 
HBITMAP hbmFill2
 
HBITMAP hbmPicker
 
HBITMAP hbmPicker2
 
HBITMAP hbmDynamic
 
HBITMAP hbmStatic
 
HBITMAP hbmExact
 

Protected Types

typedef class InternalState< class C4ToolsDlgSuper
 

Friends

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

Detailed Description

Definition at line 656 of file C4Console.cpp.

Member Typedef Documentation

◆ Super

typedef class InternalState< class C4ToolsDlg > C4ConsoleGUI::InternalState< class C4ToolsDlg >::Super
protectedinherited

Definition at line 172 of file C4ConsoleGUI.h.

Constructor & Destructor Documentation

◆ State() [1/2]

C4ToolsDlg::State::State ( C4ToolsDlg dlg)
inline

Definition at line 658 of file C4Console.cpp.

658 : State(C4ToolsDlg* dlg): Super(dlg) {}
class InternalState< class C4ToolsDlg > Super
Definition: C4ConsoleGUI.h:42
State(C4ToolsDlg *dlg)
Definition: C4Console.cpp:658

◆ State() [2/2]

C4ToolsDlg::State::State ( C4ToolsDlg toolsDlg)
inline

Definition at line 518 of file C4ConsoleWin32.cpp.

519  hbmBrush(nullptr), hbmBrush2(nullptr),
520  hbmLine(nullptr), hbmLine2(nullptr),
521  hbmRect(nullptr), hbmRect2(nullptr),
522  hbmFill(nullptr), hbmFill2(nullptr),
523  hbmPicker(nullptr), hbmPicker2(nullptr),
524  hbmDynamic(nullptr),
525  hbmStatic(nullptr),
526  hbmExact(nullptr)
527  {
528  pPreviewWindow = nullptr;
529  }
C4Window * pPreviewWindow

References pPreviewWindow.

◆ ~State()

C4ToolsDlg::State::~State ( )
inline

Definition at line 548 of file C4ConsoleWin32.cpp.

549  {
550  Clear();
551  }

References Clear().

Here is the call graph for this function:

Member Function Documentation

◆ Clear() [1/2]

void C4ToolsDlg::State::Clear ( )
inline

Definition at line 659 of file C4Console.cpp.

659 {}

Referenced by ~State().

Here is the caller graph for this function:

◆ Clear() [2/2]

void C4ToolsDlg::State::Clear ( )
inline

Definition at line 553 of file C4ConsoleWin32.cpp.

554  {
555  // Unload bitmaps
556  if (hbmBrush) { DeleteObject(hbmBrush); hbmBrush = nullptr; }
557  if (hbmLine) { DeleteObject(hbmLine); hbmLine = nullptr; }
558  if (hbmRect) { DeleteObject(hbmRect); hbmRect = nullptr; }
559  if (hbmFill) { DeleteObject(hbmFill); hbmFill = nullptr; }
560  if (hbmPicker) { DeleteObject(hbmPicker); hbmPicker = nullptr; }
561  if (hbmBrush2) { DeleteObject(hbmBrush2); hbmBrush2 = nullptr; }
562  if (hbmLine2) { DeleteObject(hbmLine2); hbmLine2 = nullptr; }
563  if (hbmRect2) { DeleteObject(hbmRect2); hbmRect2 = nullptr; }
564  if (hbmFill2) { DeleteObject(hbmFill2); hbmFill2 = nullptr; }
565  if (hbmPicker2) { DeleteObject(hbmPicker2); hbmPicker2 = nullptr; }
566  if (hbmDynamic) { DeleteObject(hbmDynamic); hbmDynamic = nullptr; }
567  if (hbmStatic) { DeleteObject(hbmStatic); hbmStatic = nullptr; }
568  if (hbmExact) { DeleteObject(hbmExact); hbmExact = nullptr; }
569  if (pPreviewWindow)
570  {
571  delete pPreviewWindow;
572  pPreviewWindow = nullptr;
573  }
574  if (hDialog) DestroyWindow(hDialog); hDialog=nullptr;
575  }

References hbmBrush, hbmBrush2, hbmDynamic, hbmExact, hbmFill, hbmFill2, hbmLine, hbmLine2, hbmPicker, hbmPicker2, hbmRect, hbmRect2, hbmStatic, hDialog, and pPreviewWindow.

◆ Default() [1/2]

void C4ToolsDlg::State::Default ( )
inline

Definition at line 660 of file C4Console.cpp.

660 {}

Referenced by C4ToolsDlg::Default().

Here is the caller graph for this function:

◆ Default() [2/2]

void C4ToolsDlg::State::Default ( )
inline

Definition at line 577 of file C4ConsoleWin32.cpp.

578  {
579  GetOwner()->ModeBack = true;
580  }
bool ModeBack
Definition: C4ToolsDlg.h:58

References C4ConsoleGUI::InternalState< class C4ToolsDlg >::GetOwner(), and C4ToolsDlg::ModeBack.

Here is the call graph for this function:

◆ GetOwner()

class C4ToolsDlg * C4ConsoleGUI::InternalState< class C4ToolsDlg >::GetOwner ( )
inlineinherited

Definition at line 47 of file C4ConsoleGUI.h.

47 {return owner;}

◆ LoadBitmaps()

void C4ToolsDlg::State::LoadBitmaps ( HINSTANCE  instance)
inline

Definition at line 531 of file C4ConsoleWin32.cpp.

532  {
533  if (!hbmBrush) hbmBrush=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_BRUSH));
534  if (!hbmLine) hbmLine=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_LINE));
535  if (!hbmRect) hbmRect=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_RECT));
536  if (!hbmFill) hbmFill=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_FILL));
537  if (!hbmPicker) hbmPicker=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_PICKER));
538  if (!hbmBrush2) hbmBrush2=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_BRUSH2));
539  if (!hbmLine2) hbmLine2=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_LINE2));
540  if (!hbmRect2) hbmRect2=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_RECT2));
541  if (!hbmFill2) hbmFill2=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_FILL2));
542  if (!hbmPicker2) hbmPicker2=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_PICKER2));
543  if (!hbmDynamic) hbmDynamic=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_DYNAMIC));
544  if (!hbmStatic) hbmStatic=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_STATIC));
545  if (!hbmExact) hbmExact=(HBITMAP)LoadBitmapW(instance,MAKEINTRESOURCEW(IDB_EXACT));
546  }
#define IDB_PICKER
Definition: resource.h:19
#define IDB_RECT2
Definition: resource.h:24
#define IDB_FILL
Definition: resource.h:11
#define IDB_FILL2
Definition: resource.h:12
#define IDB_LINE2
Definition: resource.h:16
#define IDB_PICKER2
Definition: resource.h:20
#define IDB_STATIC
Definition: resource.h:25
#define IDB_EXACT
Definition: resource.h:10
#define IDB_BRUSH
Definition: resource.h:5
#define IDB_DYNAMIC
Definition: resource.h:9
#define IDB_LINE
Definition: resource.h:15
#define IDB_RECT
Definition: resource.h:23
#define IDB_BRUSH2
Definition: resource.h:6

References hbmBrush, hbmBrush2, hbmDynamic, hbmExact, hbmFill, hbmFill2, hbmLine, hbmLine2, hbmPicker, hbmPicker2, hbmRect, hbmRect2, hbmStatic, IDB_BRUSH, IDB_BRUSH2, IDB_DYNAMIC, IDB_EXACT, IDB_FILL, IDB_FILL2, IDB_LINE, IDB_LINE2, IDB_PICKER, IDB_PICKER2, IDB_RECT, IDB_RECT2, and IDB_STATIC.

Friends And Related Function Documentation

◆ ToolsDlgProc

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

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 }
C4Config Config
Definition: C4Config.cpp:930
C4Console Console
Definition: C4Globals.cpp:45
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
const char * GetSubkeyPath(const char *subkey)
Definition: C4Config.cpp:806
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

Member Data Documentation

◆ hbmBrush

HBITMAP C4ToolsDlg::State::hbmBrush

Definition at line 509 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hbmBrush2

HBITMAP C4ToolsDlg::State::hbmBrush2

Definition at line 509 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hbmDynamic

HBITMAP C4ToolsDlg::State::hbmDynamic

Definition at line 514 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hbmExact

HBITMAP C4ToolsDlg::State::hbmExact

Definition at line 516 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hbmFill

HBITMAP C4ToolsDlg::State::hbmFill

Definition at line 512 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hbmFill2

HBITMAP C4ToolsDlg::State::hbmFill2

Definition at line 512 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hbmLine

HBITMAP C4ToolsDlg::State::hbmLine

Definition at line 510 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hbmLine2

HBITMAP C4ToolsDlg::State::hbmLine2

Definition at line 510 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hbmPicker

HBITMAP C4ToolsDlg::State::hbmPicker

Definition at line 513 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hbmPicker2

HBITMAP C4ToolsDlg::State::hbmPicker2

Definition at line 513 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hbmRect

HBITMAP C4ToolsDlg::State::hbmRect

Definition at line 511 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hbmRect2

HBITMAP C4ToolsDlg::State::hbmRect2

Definition at line 511 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hbmStatic

HBITMAP C4ToolsDlg::State::hbmStatic

Definition at line 515 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and LoadBitmaps().

◆ hDialog

HWND C4ToolsDlg::State::hDialog

Definition at line 506 of file C4ConsoleWin32.cpp.

Referenced by Clear().

◆ pPreviewWindow

C4Window* C4ToolsDlg::State::pPreviewWindow

Definition at line 507 of file C4ConsoleWin32.cpp.

Referenced by Clear(), and State().


The documentation for this class was generated from the following files: