OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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 C4ToolsDlg
Super
 

Friends

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

Detailed Description

Definition at line 661 of file C4Console.cpp.

Member Typedef Documentation

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

Definition at line 43 of file C4ConsoleGUI.h.

Constructor & Destructor Documentation

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

Definition at line 663 of file C4Console.cpp.

663 : State(C4ToolsDlg* dlg): Super(dlg) {}
State(C4ToolsDlg *dlg)
Definition: C4Console.cpp:663
class InternalState< class C4ToolsDlg > Super
Definition: C4ConsoleGUI.h:43
C4ToolsDlg::State::State ( C4ToolsDlg toolsDlg)
inline

Definition at line 518 of file C4ConsoleWin32.cpp.

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

Definition at line 548 of file C4ConsoleWin32.cpp.

References Clear().

549  {
550  Clear();
551  }

Here is the call graph for this function:

Member Function Documentation

void C4ToolsDlg::State::Clear ( )
inline

Definition at line 553 of file C4ConsoleWin32.cpp.

References pPreviewWindow.

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

Definition at line 664 of file C4Console.cpp.

Referenced by ~State().

664 {}

Here is the caller graph for this function:

void C4ToolsDlg::State::Default ( )
inline

Definition at line 577 of file C4ConsoleWin32.cpp.

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

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

Here is the call graph for this function:

void C4ToolsDlg::State::Default ( )
inline

Definition at line 665 of file C4Console.cpp.

Referenced by C4ToolsDlg::Default().

665 {}

Here is the caller graph for this function:

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

Definition at line 48 of file C4ConsoleGUI.h.

Referenced by Default().

48 {return owner;}

Here is the caller graph for this function:

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

Definition at line 531 of file C4ConsoleWin32.cpp.

References 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.

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_FILL
Definition: resource.h:11
#define IDB_PICKER2
Definition: resource.h:20
#define IDB_RECT2
Definition: resource.h:24
#define IDB_BRUSH
Definition: resource.h:5
#define IDB_LINE
Definition: resource.h:15
#define IDB_FILL2
Definition: resource.h:12
#define IDB_DYNAMIC
Definition: resource.h:9
#define IDB_LINE2
Definition: resource.h:16
#define IDB_STATIC
Definition: resource.h:25
#define IDB_EXACT
Definition: resource.h:10
#define IDB_RECT
Definition: resource.h:23
#define IDB_BRUSH2
Definition: resource.h:6

Friends And Related Function Documentation

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 }
#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

Member Data Documentation

HBITMAP C4ToolsDlg::State::hbmBrush

Definition at line 509 of file C4ConsoleWin32.cpp.

HBITMAP C4ToolsDlg::State::hbmBrush2

Definition at line 509 of file C4ConsoleWin32.cpp.

HBITMAP C4ToolsDlg::State::hbmDynamic

Definition at line 514 of file C4ConsoleWin32.cpp.

HBITMAP C4ToolsDlg::State::hbmExact

Definition at line 516 of file C4ConsoleWin32.cpp.

HBITMAP C4ToolsDlg::State::hbmFill

Definition at line 512 of file C4ConsoleWin32.cpp.

HBITMAP C4ToolsDlg::State::hbmFill2

Definition at line 512 of file C4ConsoleWin32.cpp.

HBITMAP C4ToolsDlg::State::hbmLine

Definition at line 510 of file C4ConsoleWin32.cpp.

HBITMAP C4ToolsDlg::State::hbmLine2

Definition at line 510 of file C4ConsoleWin32.cpp.

HBITMAP C4ToolsDlg::State::hbmPicker

Definition at line 513 of file C4ConsoleWin32.cpp.

HBITMAP C4ToolsDlg::State::hbmPicker2

Definition at line 513 of file C4ConsoleWin32.cpp.

HBITMAP C4ToolsDlg::State::hbmRect

Definition at line 511 of file C4ConsoleWin32.cpp.

HBITMAP C4ToolsDlg::State::hbmRect2

Definition at line 511 of file C4ConsoleWin32.cpp.

HBITMAP C4ToolsDlg::State::hbmStatic

Definition at line 515 of file C4ConsoleWin32.cpp.

HWND C4ToolsDlg::State::hDialog

Definition at line 506 of file C4ConsoleWin32.cpp.

C4Window* C4ToolsDlg::State::pPreviewWindow

Definition at line 507 of file C4ConsoleWin32.cpp.

Referenced by Clear().


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