1
2 #include "studiox_includes.h"
3 #include "sprite_edit_dialog.h"
4
5 #ifdef _DEBUG
6 #define new DEBUG_NEW
7 #endif
8
9 extern CFont TitleFont;
10 extern CFont MediumFont;
11 extern CFont NormalFont;
12
13 #define SORT_FLAG CBS_SORT
14 //#define SORT_FLAG 0
15
16 #define PROPERTY_ITEM_HEIGHT 18
17 #define PROPERTY_ITEM_SPACE 2
18 #define LEFT_COLUMN_WIDTH 140
19
20 ///////////////////////////////////////////////////////////////////////////////
21 enum CONTROL_IDS {
22 ID_WIDGET_NAME = 4096,
23 ID_WIDGET_ID,
24 ID_USER_DATA,
25 ID_EVENT_FUNCTION,
26 ID_DRAW_FUNCTION,
27 ID_ALLOCATOR_NAME,
28 ID_TRANSPARENT,
29 ID_SELECTED,
30 ID_ENABLED,
31 ID_ACCEPTS_FOCUS,
32 ID_TEMPLATE,
33 ID_VISIBLE_AT_STARTUP,
34 ID_BORDER_COMBO,
35 ID_NORMAL_COLOR,
36 ID_SELECTED_COLOR,
37 ID_DISABLED_COLOR,
38 ID_READONLY_COLOR,
39 ID_XPOS,
40 ID_YPOS,
41 ID_WIDTH,
42 ID_HEIGHT,
43 ID_TILE_WALLPAPER,
44 ID_DYNAMIC_WIDGET,
45 ID_DYNAMIC_BUFFER,
46
47 ID_PIXELMAP_0,
48 ID_PIXELMAP_1,
49 ID_PIXELMAP_2,
50 ID_PIXELMAP_3,
51 ID_PIXELMAP_4,
52 ID_PIXELMAP_5,
53 ID_PIXELMAP_6,
54 ID_PIXELMAP_7,
55
56 ID_TEXT_ALIGN,
57 ID_TEXT_COPY,
58 ID_FONT_SELECT_0,
59 ID_FONT_SELECT_1,
60 ID_FONT_SELECT_2,
61 ID_FONT_SELECT_3,
62 ID_NORMAL_TEXT_COLOR,
63 ID_SELECTED_TEXT_COLOR,
64 ID_DISABLED_TEXT_COLOR,
65 ID_READONLY_TEXT_COLOR,
66 ID_BUTTON_STYLE_PUSHED,
67 ID_BUTTON_STYLE_TOGGLE,
68 ID_BUTTON_STYLE_RADIO,
69 ID_BUTTON_STYLE_REPEAT,
70 ID_PIXMAP_HALIGN,
71 ID_PIXMAP_VALIGN,
72
73 ID_SLIDER_MINVAL,
74 ID_SLIDER_MAXVAL,
75 ID_SLIDER_CURRENTVAL,
76 ID_SLIDER_INCREMENT,
77 ID_SLIDER_MINTRAVEL,
78 ID_SLIDER_MAXTRAVEL,
79 ID_SLIDER_NEEDLE_WIDTH,
80 ID_SLIDER_NEEDLE_HEIGHT,
81 ID_SLIDER_NEEDLE_INSET,
82 ID_NEEDLE_HOTSPOT,
83 ID_TICKMARK_COUNT,
84
85 ID_SLIDER_VERTICAL,
86 ID_SHOW_TICKMARKS,
87 ID_SLIDER_TILE_BKGND,
88
89 ID_PROGRESS_VERTICAL,
90 ID_PROGRESS_SHOW_TEXT,
91 ID_PROGRESS_PERCENT,
92
93 ID_PROGRESS_MINVAL,
94 ID_PROGRESS_MAXVAL,
95 ID_PROGRESS_CURRENTVAL,
96
97 ID_RADIAL_PROGRESS_BACKTRACK,
98 ID_RADIAL_PROGRESS_SHOW_TEXT,
99 ID_RADIAL_PROGRESS_PERCENT,
100 ID_RADIAL_PROGRESS_ALIAS,
101 ID_RADIAL_PROGRESS_ROUND,
102 ID_RADIAL_PROGRESS_XCENTER,
103 ID_RADIAL_PROGRESS_YCENTER,
104 ID_RADIAL_PROGRESS_RADIUS,
105 ID_RADIAL_PROGRESS_ANCHORVAL,
106 ID_RADIAL_PROGRESS_CURRENTVAL,
107 ID_RADIAL_PROGRESS_NORMAL_BRUSH_COLOR,
108 ID_RADIAL_PROGRESS_SELECTED_BRUSH_COLOR,
109 ID_RADIAL_PROGRESS_NORMAL_BRUSH_WIDTH,
110 ID_RADIAL_PROGRESS_SELECTED_BRUSH_WIDTH,
111
112 ID_RADIAL_SLIDER_XCENTER,
113 ID_RADIAL_SLIDER_YCENTER,
114 ID_RADIAL_SLIDER_RADIUS,
115 ID_RADIAL_SLIDER_TRACK_WIDTH,
116 ID_RADIAL_SLIDER_NEEDLE_OFFSET,
117 ID_RADIAL_SLIDER_CURRENT_ANGLE,
118 ID_RADIAL_SLIDER_MIN_ANGLE,
119 ID_RADIAL_SLIDER_MAX_ANGLE,
120 ID_RADIAL_SLIDER_TOTAL_STEPS,
121 ID_RADIAL_SLIDER_DELAY,
122 ID_RADIAL_SLIDER_ANIMATION_STYLE,
123
124 ID_SPRITE_AUTO,
125 ID_SPRITE_LOOP,
126 ID_SPRITE_EDIT_FRAMES,
127
128 ID_SCROLL_THUMB_COLOR,
129 ID_SCROLL_THUMB_BORDER_COLOR,
130 ID_SCROLL_BUTTON_COLOR,
131 ID_THUMB_WIDTH,
132 ID_THUMB_TRAVEL_MIN,
133 ID_THUMB_TRAVEL_MAX,
134 ID_SCROLL_THUMB_BORDER_STYLE,
135 ID_SCROLL_END_BUTTONS,
136 ID_SCROLL_TILE_BKGND,
137 ID_SCROLL_RELATIVE_THUMB,
138 ID_SCROLL_IS_DEFAULT,
139
140 ID_LIST_WRAP,
141 ID_LIST_REPEAT_SELECT,
142 ID_LIST_ROWS,
143 ID_OPEN_HEIGHT,
144 ID_CALLBACK_NAME,
145
146 ID_ML_TEXT_VCENTER,
147 ID_TEXT_VIEW_WHITESPACE,
148 ID_TEXT_VIEW_LINE_SPACE,
149
150 ID_TEXT_INPUT_READONLY,
151 ID_BUFFER_SIZE,
152
153 ID_STRING_ID,
154 ID_STRING_VAL,
155
156 ID_GAUGE_START_ANGLE,
157 ID_GAUGE_ANIMATION_STEPS,
158 ID_GAUGE_ANIMATION_DELAY,
159 ID_GAUGE_NEEDLE_XPOS,
160 ID_GAUGE_NEEDLE_YPOS,
161 ID_GAUGE_NEEDLE_XCOR,
162 ID_GAUGE_NEEDLE_YCOR,
163
164 ID_CHART_MIN_VAL,
165 ID_CHART_MAX_VAL,
166 ID_CHART_LEFT_MARGIN,
167 ID_CHART_TOP_MARGIN,
168 ID_CHART_RIGHT_MARGIN,
169 ID_CHART_BOTTOM_MARGIN,
170 ID_CHART_MAX_COUNT,
171 ID_CHART_AXIS_WIDTH,
172 ID_CHART_LINE_WIDTH,
173 ID_CHART_AXIS_COLOR,
174 ID_CHART_LINE_COLOR,
175
176 ID_SCROLL_WHEEL_TOTAL_ROWS,
177 ID_SCROLL_WHEEL_SELECTED_ROW,
178 ID_SCROLL_WHEEL_ROW_HEIHGT,
179 ID_SCROLL_WHEEL_START_ALPHA,
180 ID_SCROLL_WHEEL_END_ALPHA,
181
182 ID_TEXT_SCROLL_WHEEL_NORMAL_FONT,
183 ID_TEXT_SCROLL_WHEEL_SELECTED_FONT,
184 ID_TEXT_SCROLL_WHEEL_ROUND,
185
186 ID_STRING_SCROLL_WHEEL_EDIT_STRINGS,
187
188 ID_NUMERIC_SCROLL_WHEEL_START_VAL,
189 ID_NUMERIC_SCROLL_WHEEL_END_VAL,
190
191 ID_TILE_DROP_LIST_BACKGROUND,
192 ID_TILE_DROP_LIST_POPLIST_WALLPAPER,
193
194 ID_NUMERIC_PROMPT_VALUE,
195 ID_FORMAT_FUNC,
196
197 ID_MENU_EXPANDED,
198 ID_MENU_INSERT_MODE,
199 ID_MENU_TEXT_X_OFFSET,
200 ID_MENU_TEXT_Y_OFFSET,
201
202 ID_TREE_VIEW_ROOT_LINE_COLOR,
203 ID_TREE_VIEW_SHOW_ROOT_LINES,
204 ID_TREE_VIEW_INDENTATION,
205
206 ID_RICH_TEXT_VIEW_TEXT_EDIT
207 };
208
209 ///////////////////////////////////////////////////////////////////////////////
210 STRING_VAL_PAIR border_types[] = {
211 {_T("No Border"), GX_STYLE_BORDER_NONE},
212 {_T("Thin Border"), GX_STYLE_BORDER_THIN},
213 {_T("Raised Border"), GX_STYLE_BORDER_RAISED},
214 {_T("Recessed Border"), GX_STYLE_BORDER_RECESSED},
215 {_T("Thick Border"), GX_STYLE_BORDER_THICK},
216 {_T(""), 0}
217 };
218
219 ///////////////////////////////////////////////////////////////////////////////
220 STRING_VAL_PAIR button_halign_styles[] = {
221 { _T("Center"), GX_STYLE_HALIGN_CENTER },
222 { _T("Left"), GX_STYLE_HALIGN_LEFT },
223 { _T("Right"), GX_STYLE_HALIGN_RIGHT },
224 {NULL, 0}
225 };
226
227 ///////////////////////////////////////////////////////////////////////////////
228 STRING_VAL_PAIR button_valign_styles[] = {
229 { _T("Center"), GX_STYLE_VALIGN_CENTER },
230 { _T("Top"), GX_STYLE_VALIGN_TOP },
231 { _T("Bottom"), GX_STYLE_VALIGN_BOTTOM },
232 {NULL, 0}
233 };
234
235 ///////////////////////////////////////////////////////////////////////////////
236 STRING_VAL_PAIR text_align_styles[] = {
237 { _T("Left"), GX_STYLE_TEXT_LEFT },
238 { _T("Center"), GX_STYLE_TEXT_CENTER },
239 { _T("Right"), GX_STYLE_TEXT_RIGHT },
240 {NULL, 0}
241 };
242
243 extern STRING_VAL_PAIR easing_function_list[];
244
245 enum properties_win_test_commands{
246 TEST_EDIT_WIDGET_PROPS = 1,
247 TEST_EDIT_WIDGET_PROPS_POST
248 };
249
250 ///////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(properties_win,CWnd)251 BEGIN_MESSAGE_MAP(properties_win, CWnd)
252 ON_WM_CREATE()
253 ON_WM_ERASEBKGND()
254 ON_WM_PAINT()
255 ON_WM_SIZE()
256 ON_WM_CTLCOLOR()
257 ON_WM_SYSCHAR()
258
259 ON_WM_VSCROLL()
260 ON_WM_MOUSEWHEEL()
261 //ON_WM_COMMAND()
262
263 ON_EN_KILLFOCUS(ID_WIDGET_NAME, OnChangeWidgetName)
264 ON_EN_KILLFOCUS(ID_WIDGET_ID, OnChangeWidgetId)
265 ON_EN_KILLFOCUS(ID_EVENT_FUNCTION, OnChangeEventFunction)
266 ON_EN_KILLFOCUS(ID_DRAW_FUNCTION, OnChangeDrawFunction)
267 ON_EN_KILLFOCUS(ID_USER_DATA, OnChangeWidgetUserData)
268
269 ON_EN_KILLFOCUS(ID_XPOS, OnChangeWidgetPos)
270 ON_EN_KILLFOCUS(ID_YPOS, OnChangeWidgetPos)
271 ON_EN_KILLFOCUS(ID_WIDTH, OnChangeWidgetPos)
272 ON_EN_KILLFOCUS(ID_HEIGHT, OnChangeWidgetPos)
273
274 ON_EN_KILLFOCUS(ID_NUMERIC_PROMPT_VALUE, OnChangeNumericPrompt)
275 ON_EN_KILLFOCUS(ID_FORMAT_FUNC, OnChangeNumericPrompt)
276
277 ON_EN_KILLFOCUS(ID_LIST_ROWS, OnChangeListRows)
278 ON_EN_KILLFOCUS(ID_OPEN_HEIGHT, OnChangeOpenHeight)
279 ON_EN_KILLFOCUS(ID_TEXT_VIEW_LINE_SPACE, OnChangeTextViewLineSpace)
280 ON_EN_KILLFOCUS(ID_TEXT_VIEW_WHITESPACE, OnChangeTextViewWhitespace)
281 ON_EN_KILLFOCUS(ID_BUFFER_SIZE, OnChangeTextBufferSize)
282 ON_EN_KILLFOCUS(ID_SLIDER_MINVAL, OnChangeSliderInfo)
283 ON_EN_KILLFOCUS(ID_SLIDER_MAXVAL, OnChangeSliderInfo)
284 ON_EN_KILLFOCUS(ID_SLIDER_CURRENTVAL, OnChangeSliderInfo)
285 ON_EN_KILLFOCUS(ID_SLIDER_INCREMENT, OnChangeSliderInfo)
286 ON_EN_KILLFOCUS(ID_SLIDER_MINTRAVEL, OnChangeSliderInfo)
287 ON_EN_KILLFOCUS(ID_SLIDER_MAXTRAVEL, OnChangeSliderInfo)
288 ON_EN_KILLFOCUS(ID_SLIDER_NEEDLE_WIDTH, OnChangeSliderInfo)
289 ON_EN_KILLFOCUS(ID_SLIDER_NEEDLE_HEIGHT, OnChangeSliderInfo)
290 ON_EN_KILLFOCUS(ID_SLIDER_NEEDLE_INSET, OnChangeSliderInfo)
291 ON_EN_KILLFOCUS(ID_NEEDLE_HOTSPOT, OnChangeSliderInfo)
292 ON_EN_KILLFOCUS(ID_TICKMARK_COUNT, OnChangeSliderInfo)
293 ON_EN_KILLFOCUS(ID_CALLBACK_NAME, OnChangeCallbackName)
294 ON_EN_KILLFOCUS(ID_STRING_VAL, OnChangeStringText)
295 ON_EN_KILLFOCUS(ID_THUMB_WIDTH, OnScrollAppearanceChange)
296 ON_EN_KILLFOCUS(ID_THUMB_TRAVEL_MIN, OnScrollAppearanceChange)
297 ON_EN_KILLFOCUS(ID_THUMB_TRAVEL_MAX, OnScrollAppearanceChange)
298
299 ON_EN_KILLFOCUS(ID_PROGRESS_MINVAL, OnProgressInfoChange)
300 ON_EN_KILLFOCUS(ID_PROGRESS_MAXVAL, OnProgressInfoChange)
301 ON_EN_KILLFOCUS(ID_PROGRESS_CURRENTVAL, OnProgressInfoChange)
302
303 ON_EN_KILLFOCUS(ID_RADIAL_PROGRESS_XCENTER, OnChangeRadialProgressBarInfo)
304 ON_EN_KILLFOCUS(ID_RADIAL_PROGRESS_YCENTER, OnChangeRadialProgressBarInfo)
305 ON_EN_KILLFOCUS(ID_RADIAL_PROGRESS_RADIUS, OnChangeRadialProgressBarInfo)
306 ON_EN_KILLFOCUS(ID_RADIAL_PROGRESS_CURRENTVAL, OnChangeRadialProgressBarInfo)
307 ON_EN_KILLFOCUS(ID_RADIAL_PROGRESS_NORMAL_BRUSH_WIDTH, OnChangeRadialProgressBarInfo)
308 ON_EN_KILLFOCUS(ID_RADIAL_PROGRESS_SELECTED_BRUSH_WIDTH, OnChangeRadialProgressBarInfo)
309 ON_CBN_SELCHANGE(ID_RADIAL_PROGRESS_NORMAL_BRUSH_COLOR, OnChangeRadialProgressBarInfo)
310 ON_CBN_SELCHANGE(ID_RADIAL_PROGRESS_SELECTED_BRUSH_COLOR, OnChangeRadialProgressBarInfo)
311
312 ON_EN_KILLFOCUS(ID_RADIAL_SLIDER_XCENTER, OnChangeRadialSliderInfo)
313 ON_EN_KILLFOCUS(ID_RADIAL_SLIDER_YCENTER, OnChangeRadialSliderInfo)
314 ON_EN_KILLFOCUS(ID_RADIAL_SLIDER_RADIUS, OnChangeRadialSliderInfo)
315 ON_EN_KILLFOCUS(ID_RADIAL_SLIDER_TRACK_WIDTH, OnChangeRadialSliderInfo)
316 ON_EN_KILLFOCUS(ID_RADIAL_SLIDER_NEEDLE_OFFSET, OnChangeRadialSliderInfo)
317 ON_EN_KILLFOCUS(ID_RADIAL_SLIDER_CURRENT_ANGLE, OnChangeRadialSliderInfo)
318 ON_EN_KILLFOCUS(ID_RADIAL_SLIDER_MIN_ANGLE, OnChangeRadialSliderInfo)
319 ON_EN_KILLFOCUS(ID_RADIAL_SLIDER_MAX_ANGLE, OnChangeRadialSliderInfo)
320 ON_EN_KILLFOCUS(ID_RADIAL_SLIDER_TOTAL_STEPS, OnChangeRadialSliderInfo)
321 ON_EN_KILLFOCUS(ID_RADIAL_SLIDER_DELAY, OnChangeRadialSliderInfo)
322 ON_CBN_SELCHANGE(ID_RADIAL_SLIDER_ANIMATION_STYLE, OnChangeRadialSliderInfo)
323
324 ON_CBN_SELCHANGE(ID_BORDER_COMBO, OnChangeBorder)
325 ON_CBN_SELCHANGE(ID_NORMAL_COLOR, OnChangeColor)
326 ON_CBN_SELCHANGE(ID_SELECTED_COLOR, OnChangeColor)
327 ON_CBN_SELCHANGE(ID_DISABLED_COLOR, OnChangeColor)
328
329 ON_CBN_SELCHANGE(ID_PIXELMAP_0, OnChangePixelmap0)
330 ON_CBN_SELCHANGE(ID_PIXELMAP_1, OnChangePixelmap1)
331 ON_CBN_SELCHANGE(ID_PIXELMAP_2, OnChangePixelmap2)
332 ON_CBN_SELCHANGE(ID_PIXELMAP_3, OnChangePixelmap3)
333 ON_CBN_SELCHANGE(ID_PIXELMAP_4, OnChangePixelmap4)
334 ON_CBN_SELCHANGE(ID_PIXELMAP_5, OnChangePixelmap5)
335 ON_CBN_SELCHANGE(ID_PIXELMAP_6, OnChangePixelmap6)
336 ON_CBN_SELCHANGE(ID_PIXELMAP_7, OnChangePixelmap7)
337
338 ON_CBN_SELCHANGE(ID_TEXT_ALIGN, OnTextAlignmentChange)
339 ON_CBN_SELCHANGE(ID_FONT_SELECT_0, OnFontChange0)
340 ON_CBN_SELCHANGE(ID_FONT_SELECT_1, OnFontChange1)
341 ON_CBN_SELCHANGE(ID_FONT_SELECT_2, OnFontChange2)
342 ON_CBN_SELCHANGE(ID_FONT_SELECT_3, OnFontChange3)
343 ON_CBN_SELCHANGE(ID_NORMAL_TEXT_COLOR, OnChangeNormalTextColor)
344 ON_CBN_SELCHANGE(ID_SELECTED_TEXT_COLOR, OnChangeSelectedTextColor)
345 ON_CBN_SELCHANGE(ID_DISABLED_TEXT_COLOR, OnChangeDisabledTextColor)
346 ON_CBN_SELCHANGE(ID_READONLY_COLOR, OnChangeReadonlyFillColor)
347 ON_CBN_SELCHANGE(ID_READONLY_TEXT_COLOR, OnChangeReadonlyTextColor)
348 ON_CBN_SELCHANGE(ID_PIXMAP_HALIGN, OnChangePixmapAlign)
349 ON_CBN_SELCHANGE(ID_PIXMAP_VALIGN, OnChangePixmapAlign)
350
351 ON_CBN_SELCHANGE(ID_STRING_ID, OnChangeStringId)
352
353 ON_BN_CLICKED(ID_DYNAMIC_WIDGET, OnChangeDynamicWidget)
354 ON_BN_CLICKED(ID_DYNAMIC_BUFFER, OnChangeDynamicBuffer)
355 ON_BN_CLICKED(ID_SLIDER_VERTICAL, OnSliderStyleChange)
356 ON_BN_CLICKED(ID_SHOW_TICKMARKS, OnSliderStyleChange)
357 ON_BN_CLICKED(ID_SLIDER_TILE_BKGND, OnSliderStyleChange)
358 ON_BN_CLICKED(ID_TILE_DROP_LIST_BACKGROUND, OnDropListStyleChange)
359 ON_BN_CLICKED(ID_TILE_DROP_LIST_POPLIST_WALLPAPER, OnDropListStyleChange)
360
361 ON_BN_CLICKED(ID_PROGRESS_VERTICAL, OnProgressInfoChange)
362 ON_BN_CLICKED(ID_PROGRESS_SHOW_TEXT, OnProgressInfoChange)
363 ON_BN_CLICKED(ID_PROGRESS_PERCENT, OnProgressInfoChange)
364 ON_BN_CLICKED(ID_RADIAL_PROGRESS_SHOW_TEXT, OnChangeRadialProgressBarInfo)
365 ON_BN_CLICKED(ID_RADIAL_PROGRESS_PERCENT, OnChangeRadialProgressBarInfo)
366 ON_BN_CLICKED(ID_RADIAL_PROGRESS_BACKTRACK, OnChangeRadialProgressBarInfo)
367 ON_BN_CLICKED(ID_RADIAL_PROGRESS_ALIAS, OnChangeRadialProgressBarInfo)
368 ON_BN_CLICKED(ID_RADIAL_PROGRESS_ROUND, OnChangeRadialProgressBarInfo)
369
370 ON_BN_CLICKED(ID_SPRITE_AUTO, OnSpriteStyleChange)
371 ON_BN_CLICKED(ID_SPRITE_LOOP, OnSpriteStyleChange)
372 ON_BN_CLICKED(ID_SPRITE_EDIT_FRAMES, OnEditSpriteFrames)
373
374 ON_CBN_SELCHANGE(ID_SCROLL_THUMB_COLOR, OnScrollAppearanceChange)
375 ON_CBN_SELCHANGE(ID_SCROLL_THUMB_BORDER_COLOR, OnScrollAppearanceChange)
376 ON_CBN_SELCHANGE(ID_SCROLL_BUTTON_COLOR, OnScrollAppearanceChange)
377 ON_CBN_SELCHANGE(ID_SCROLL_THUMB_BORDER_STYLE, OnScrollAppearanceChange)
378 ON_BN_CLICKED(ID_SCROLL_END_BUTTONS, OnScrollStyleChange)
379 ON_BN_CLICKED(ID_SCROLL_TILE_BKGND, OnScrollStyleChange)
380 ON_BN_CLICKED(ID_SCROLL_RELATIVE_THUMB, OnScrollStyleChange)
381
382 ON_BN_CLICKED(ID_TRANSPARENT, OnChangeTransparent)
383 ON_BN_CLICKED(ID_SELECTED, OnChangeSelected)
384 ON_BN_CLICKED(ID_ENABLED, OnChangeEnabled)
385 ON_BN_CLICKED(ID_TEXT_COPY, OnChangeTextCopy)
386 ON_BN_CLICKED(ID_ML_TEXT_VCENTER, OnChangeMLTextVCenter)
387 ON_BN_CLICKED(ID_ACCEPTS_FOCUS, OnChangeFocus)
388 ON_BN_CLICKED(ID_TILE_WALLPAPER, OnChangeTileWallpaper)
389 ON_BN_CLICKED(ID_BUTTON_STYLE_PUSHED, OnButtonStyleChange)
390 ON_BN_CLICKED(ID_BUTTON_STYLE_TOGGLE, OnButtonStyleChange)
391 ON_BN_CLICKED(ID_BUTTON_STYLE_RADIO, OnButtonStyleChange)
392 ON_BN_CLICKED(ID_BUTTON_STYLE_REPEAT, OnButtonStyleChange)
393 ON_BN_CLICKED(ID_LIST_WRAP, OnChangeListWrap)
394 ON_BN_CLICKED(ID_LIST_REPEAT_SELECT, OnChangeListRepeatSelect)
395 ON_BN_CLICKED(ID_TEMPLATE, OnChangeTemplate)
396 ON_BN_CLICKED(ID_VISIBLE_AT_STARTUP, OnChangeVisibleAtStartup)
397 ON_BN_CLICKED(ID_TEXT_INPUT_READONLY, OnChangeReadonly)
398
399 ON_EN_KILLFOCUS(ID_GAUGE_ANIMATION_STEPS, OnChangeGaugeInfo)
400 ON_EN_KILLFOCUS(ID_GAUGE_ANIMATION_DELAY, OnChangeGaugeInfo)
401 ON_EN_KILLFOCUS(ID_GAUGE_NEEDLE_XPOS, OnChangeGaugeInfo)
402 ON_EN_KILLFOCUS(ID_GAUGE_NEEDLE_YPOS, OnChangeGaugeInfo)
403 ON_EN_KILLFOCUS(ID_GAUGE_NEEDLE_XCOR, OnChangeGaugeInfo)
404 ON_EN_KILLFOCUS(ID_GAUGE_NEEDLE_YCOR, OnChangeGaugeInfo)
405
406 ON_EN_KILLFOCUS(ID_CHART_MIN_VAL, OnChangeChartInfo)
407 ON_EN_KILLFOCUS(ID_CHART_MAX_VAL, OnChangeChartInfo)
408 ON_EN_KILLFOCUS(ID_CHART_LEFT_MARGIN, OnChangeChartInfo)
409 ON_EN_KILLFOCUS(ID_CHART_TOP_MARGIN, OnChangeChartInfo)
410 ON_EN_KILLFOCUS(ID_CHART_RIGHT_MARGIN, OnChangeChartInfo)
411 ON_EN_KILLFOCUS(ID_CHART_BOTTOM_MARGIN, OnChangeChartInfo)
412 ON_EN_KILLFOCUS(ID_CHART_MAX_COUNT, OnChangeChartInfo)
413 ON_EN_KILLFOCUS(ID_CHART_AXIS_WIDTH, OnChangeChartInfo)
414 ON_EN_KILLFOCUS(ID_CHART_LINE_WIDTH, OnChangeChartInfo)
415 ON_CBN_SELCHANGE(ID_CHART_AXIS_COLOR, OnChangeChartInfo)
416 ON_CBN_SELCHANGE(ID_CHART_LINE_COLOR, OnChangeChartInfo)
417
418 ON_EN_KILLFOCUS(ID_SCROLL_WHEEL_SELECTED_ROW, OnChangeScrollWheelProps)
419 ON_EN_KILLFOCUS(ID_SCROLL_WHEEL_ROW_HEIHGT, OnChangeScrollWheelProps)
420 ON_EN_KILLFOCUS(ID_SCROLL_WHEEL_TOTAL_ROWS, OnChangeScrollWheelProps)
421 ON_EN_KILLFOCUS(ID_SCROLL_WHEEL_START_ALPHA, OnChangeScrollWheelProps)
422 ON_EN_KILLFOCUS(ID_SCROLL_WHEEL_END_ALPHA, OnChangeScrollWheelProps)
423
424 ON_CBN_SELCHANGE(ID_TEXT_SCROLL_WHEEL_NORMAL_FONT, OnChangeTextScrollWheelProps)
425 ON_CBN_SELCHANGE(ID_TEXT_SCROLL_WHEEL_SELECTED_FONT, OnChangeTextScrollWheelProps)
426 ON_BN_CLICKED(ID_TEXT_SCROLL_WHEEL_ROUND, OnChangeTextScrollWheelProps)
427
428 ON_BN_CLICKED(ID_STRING_SCROLL_WHEEL_EDIT_STRINGS, OnEditStringScrolWheelStrings)
429
430 ON_EN_KILLFOCUS(ID_NUMERIC_SCROLL_WHEEL_START_VAL, OnChangeNumericScrollWheelRange)
431 ON_EN_KILLFOCUS(ID_NUMERIC_SCROLL_WHEEL_END_VAL, OnChangeNumericScrollWheelRange)
432
433 ON_BN_CLICKED(ID_MENU_EXPANDED, OnChangeMenuInfo)
434 ON_BN_CLICKED(ID_MENU_INSERT_MODE, OnChangeMenuInfo)
435 ON_EN_KILLFOCUS(ID_MENU_TEXT_X_OFFSET, OnChangeMenuInfo)
436 ON_EN_KILLFOCUS(ID_MENU_TEXT_Y_OFFSET, OnChangeMenuInfo)
437
438 ON_EN_KILLFOCUS(ID_TREE_VIEW_INDENTATION, OnChangeTreeViewInfo)
439 ON_BN_CLICKED(ID_TREE_VIEW_SHOW_ROOT_LINES, OnChangeTreeViewInfo)
440 ON_CBN_SELCHANGE(ID_TREE_VIEW_ROOT_LINE_COLOR, OnChangeTreeViewInfo)
441 ON_BN_CLICKED(ID_RICH_TEXT_VIEW_TEXT_EDIT, OnEditRichTextViewText)
442
443 ON_MESSAGE(STUDIO_TEST, OnTestMessage)
444 ON_WM_LBUTTONDOWN()
445 ON_WM_NCLBUTTONDOWN()
446 ON_WM_SETTINGCHANGE()
447 END_MESSAGE_MAP()
448
449
450 ///////////////////////////////////////////////////////////////////////////////
451 properties_win::properties_win()
452 {
453 m_top_pos = 0;
454 mpInfo = NULL;
455 mpProject = NULL;
456 m_scroll_helper = new CScrollHelper;
457 m_scroll_helper->AttachWnd(this);
458
459 SetControlSize();
460 }
461
462 ///////////////////////////////////////////////////////////////////////////////
~properties_win()463 properties_win::~properties_win()
464 {
465 delete m_scroll_helper;
466 }
467
SetControlSize()468 void properties_win::SetControlSize()
469 {
470 int dpi = GetSystemDPI();
471 int text_scaler = GetTextScaler();
472 m_item_height = GetScaledValue(PROPERTY_ITEM_HEIGHT, dpi, text_scaler);
473 m_row_height = m_item_height + PROPERTY_ITEM_SPACE;
474 m_leftcol_width = GetScaledValue(LEFT_COLUMN_WIDTH, dpi, text_scaler);
475 }
476
477 ///////////////////////////////////////////////////////////////////////////////
OnTabKey()478 void properties_win::OnTabKey()
479 {
480 int nShiftKey = GetKeyState(VK_SHIFT);
481 int bPrevious = FALSE;
482
483 if(nShiftKey & KEY_STATE_DOWN)
484 {
485 bPrevious = TRUE;
486 }
487
488 CWnd *next = GetNextDlgTabItem(GetFocus(), bPrevious);
489
490 if (next)
491 {
492 CRect size;
493 next->GetWindowRect(&size);
494 ScreenToClient(&size);
495
496 CRect client;
497 GetClientRect(&client);
498
499 int shift = 0;
500
501 // test if next focus owner visible
502 if (size.top < client.top)
503 {
504 shift = size.top - client.top;
505 }
506 else if (size.bottom > client.bottom)
507 {
508 shift = size.bottom - client.bottom;
509 }
510
511 // Scroll to make next focus owner visible
512 if (shift)
513 {
514 m_scroll_helper->Scroll(SB_VERT, shift);
515 }
516 }
517 }
518
519 ///////////////////////////////////////////////////////////////////////////////
OnPageUp()520 void properties_win::OnPageUp()
521 {
522 CRect client;
523
524 GetClientRect(&client);
525
526 m_scroll_helper->Scroll(SB_VERT, -client.Height());
527
528 CWnd* next = GetFocus();
529 CRect size;
530
531 // If current focus owner is not visible,
532 // try to move focus to next visible tab item
533 while (next)
534 {
535 //Get control size
536 next->GetWindowRect(&size);
537 ScreenToClient(&size);
538
539 if (size.bottom > client.bottom)
540 {
541 next = GetNextDlgTabItem(next, TRUE);
542 }
543 else
544 {
545 next->SetFocus();
546 break;
547 }
548 }
549 }
550
551 ///////////////////////////////////////////////////////////////////////////////
OnPageDown()552 void properties_win::OnPageDown()
553 {
554 CRect client;
555
556 GetClientRect(&client);
557
558 m_scroll_helper->Scroll(SB_VERT, client.Height());
559
560 CWnd* next = GetFocus();
561 CRect size;
562
563 // If current focus owner is not visible,
564 // try to move focus to next visible tab item
565 while (next)
566 {
567 //Get control size
568 next->GetWindowRect(&size);
569 ScreenToClient(&size);
570
571 if (size.top < client.top)
572 {
573 next = GetNextDlgTabItem(next, FALSE);
574 }
575 else
576 {
577 next->SetFocus();
578 break;
579 }
580 }
581 }
582
583 ///////////////////////////////////////////////////////////////////////////////
PreTranslateMessage(MSG * pMsg)584 BOOL properties_win::PreTranslateMessage(MSG* pMsg)
585 {
586 // TODO: Add your specialized code here and/or call the base class
587 if(pMsg->message == WM_MOUSEWHEEL)
588 {
589 TCHAR class_name[MAX_PATH];
590 GetClassName(pMsg->hwnd, class_name, MAX_PATH - 1);
591
592 if (_tccmp(class_name, _T("ComboBox")) == 0)
593 {
594 PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
595 return TRUE;
596 }
597
598 }
599 else if (pMsg->message == WM_KEYDOWN)
600 {
601 CWnd *focus_owner = GetFocus();
602 switch (pMsg->wParam)
603 {
604 case VK_RETURN:
605 if (focus_owner && (GetDlgItem(ID_STRING_VAL) == focus_owner))
606 {
607 SendMessage(WM_COMMAND, MAKEWPARAM(focus_owner->GetDlgCtrlID(), EN_KILLFOCUS), (LPARAM)(focus_owner->m_hWnd));
608 return TRUE;
609 }
610 break;
611
612 case VK_TAB:
613 OnTabKey();
614 break;
615
616 case VK_PRIOR:
617 OnPageUp();
618 return TRUE;
619
620 case VK_NEXT:
621 OnPageDown();
622 return TRUE;
623
624 default:
625 break;
626 }
627 }
628 else if(pMsg->message == WM_SYSKEYDOWN)
629 {
630 int nAltKey = GetKeyState(VK_MENU);
631
632 switch (pMsg->wParam)
633 {
634 case VK_UP:
635 case VK_LEFT:
636 if (nAltKey & KEY_STATE_DOWN)
637 {
638 //move focus to project view
639 project_view* view = GetProjectView();
640 if (view)
641 {
642 view->SetFocus();
643 return TRUE;
644 }
645 }
646 break;
647
648 case VK_DOWN:
649 case VK_RIGHT:
650 if (nAltKey & KEY_STATE_DOWN)
651 {
652 //Move focus to target view
653 target_view* view = GetTargetView();
654 if (view)
655 {
656 CMainFrame* frame = (CMainFrame*)GetParentFrame();
657 frame->SetActiveView(view);
658 return TRUE;
659 }
660 }
661 break;
662
663 default:
664 break;
665 }
666 }
667
668 return CDialog::PreTranslateMessage(pMsg);
669 }
670
671 ///////////////////////////////////////////////////////////////////////////////
OnCreate(LPCREATESTRUCT lpcs)672 int properties_win::OnCreate(LPCREATESTRUCT lpcs)
673 {
674 CWnd::OnCreate(lpcs);
675
676 CMainFrame *frame = (CMainFrame *) GetParentFrame();
677 frame ->SetPropsWin(this);
678 SetWindowText(_T("Properties Win"));
679 return 0;
680 }
681
682 ///////////////////////////////////////////////////////////////////////////////
OnEraseBkgnd(CDC * pDC)683 BOOL properties_win::OnEraseBkgnd(CDC* pDC)
684 {
685 // Set brush to desired background color
686 CBrush backBrush(RGB(210, 210, 210));
687
688 // Save old brush
689 CBrush* pOldBrush = pDC->SelectObject(&backBrush);
690
691 CRect rect;
692 pDC->GetClipBox(&rect); // Erase the area needed
693
694 pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
695 PATCOPY);
696 pDC->SelectObject(pOldBrush);
697 return TRUE;
698 }
699
700 ///////////////////////////////////////////////////////////////////////////////
OnVScroll(UINT nSBCode,UINT nPos,CScrollBar * pScrollBar)701 void properties_win::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
702 {
703 m_scroll_helper->OnVScroll(nSBCode, nPos, pScrollBar);
704 }
705
706 ///////////////////////////////////////////////////////////////////////////////
OnMouseWheel(UINT nFlags,short zDelta,CPoint pt)707 BOOL properties_win::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
708 {
709 BOOL wasScrolled = m_scroll_helper->OnMouseWheel(nFlags, zDelta, pt);
710 return wasScrolled;
711 }
712
713 ///////////////////////////////////////////////////////////////////////////////
OnLButtonDown(UINT nFlags,CPoint point)714 void properties_win::OnLButtonDown(UINT nFlags, CPoint point)
715 {
716 // TODO: Add your message handler code here and/or call default
717 SetFocus();
718 CDialog::OnLButtonDown(nFlags, point);
719 }
720
721 ///////////////////////////////////////////////////////////////////////////////
OnNcLButtonDown(UINT nHitTest,CPoint point)722 void properties_win::OnNcLButtonDown(UINT nHitTest, CPoint point)
723 {
724 // TODO: Add your message handler code here and/or call default
725 SetFocus();
726 CDialog::OnNcLButtonDown(nHitTest, point);
727 }
728
729 ///////////////////////////////////////////////////////////////////////////////
OnSize(UINT nType,int cx,int cy)730 void properties_win::OnSize(UINT nType, int cx, int cy)
731 {
732 CWnd::OnSize(nType, cx, cy);
733 m_scroll_helper->OnSize(nType, cx, cy);
734 OnWidgetSelect(mpInfo);
735 }
736
737
738 ///////////////////////////////////////////////////////////////////////////////
OnPaint()739 void properties_win::OnPaint()
740 {
741 CDC *dc = GetDC();
742 CRect rect;
743
744 CDialog::OnPaint();
745 ReleaseDC(dc);
746 }
747
748 ///////////////////////////////////////////////////////////////////////////////
OnCtlColor(CDC * pDC,CWnd * pWnd,UINT nCtlColor)749 HBRUSH properties_win::OnCtlColor(CDC *pDC, CWnd *pWnd, UINT nCtlColor)
750 {
751 int nCtrlId = pWnd->GetDlgCtrlID();
752
753 HBRUSH hbr = CWnd::OnCtlColor(pDC, pWnd, nCtlColor);
754 return hbr;
755 }
756
757 ///////////////////////////////////////////////////////////////////////////////
OnCommand(WPARAM wParam,LPARAM lParam)758 BOOL properties_win::OnCommand(WPARAM wParam, LPARAM lParam)
759 {
760 if (wParam == IDOK)
761 {
762 CWnd *child = GetFocus();
763
764 if (child)
765 {
766 SetFocus();
767 child->SetFocus();
768 return TRUE;
769 }
770 }
771 return CWnd::OnCommand(wParam, lParam);
772 }
773
774 ///////////////////////////////////////////////////////////////////////////////
OnSysChar(UINT nChar,UINT nRepCnt,UINT nFlags)775 void properties_win::OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags)
776 {
777 if (nChar == 0x0d)
778 {
779 CWnd *pctrl = GetFocus();
780 int ctrl_id = pctrl->GetDlgCtrlID();
781
782 switch(ctrl_id)
783 {
784 case ID_WIDGET_NAME:
785 case ID_WIDGET_ID:
786 case ID_EVENT_FUNCTION:
787 case ID_DRAW_FUNCTION:
788 OnChangeWidgetName();
789 break;
790
791 case ID_USER_DATA:
792 OnChangeWidgetUserData();
793 break;
794 }
795 }
796 }
797
798 ///////////////////////////////////////////////////////////////////////////////
AssignChildFont()799 void properties_win::AssignChildFont()
800 {
801 CWnd *child = GetWindow(GW_CHILD);
802
803 while(child)
804 {
805 child->SetFont(&NormalFont, FALSE);
806 child->ShowWindow(SW_SHOW);
807
808 child = child->GetNextWindow();
809 }
810 }
811
812 ///////////////////////////////////////////////////////////////////////////////
DestroyChildren()813 void properties_win::DestroyChildren()
814 {
815 CWnd *child = GetWindow(GW_CHILD);
816
817 while(child)
818 {
819 child->DestroyWindow();
820 delete child;
821 child = GetWindow(GW_CHILD);
822 }
823 }
824
825 ///////////////////////////////////////////////////////////////////////////////
AddComboBox(char * label,int res_type,int id,ULONG current_val)826 void properties_win::AddComboBox(char *label, int res_type, int id, ULONG current_val)
827 {
828 int right;
829 int list_index;
830 CRect size;
831 CString cs(label);
832 GetClientRect(&size);
833
834 size.top += m_top_pos;
835 size.left += PROPERTY_ITEM_SPACE;
836 size.right -= PROPERTY_ITEM_SPACE;
837 right = size.right;
838 size.right = size.left + m_leftcol_width;
839 size.bottom = size.top + m_item_height;
840
841 CStatic *pDesc = new CStatic();
842 pDesc->Create(cs, WS_CHILD | SS_LEFT, size, this);
843
844 size.top -= 2;
845 size.left = size.right + 1;
846 size.right = right;
847 size.bottom = size.top + 200;
848
849 express_combobox *pBox = new express_combobox();
850 pBox->Create(WS_CHILD | WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWNLIST | SORT_FLAG, size, this, id);
851 pBox->SetItemHeight(-1, m_item_height - 2);
852
853 int active_display = GetProjectView()->GetActiveDisplay();
854 int res_id;
855 int start_id = 0;
856 int end_id = mpProject->CountResources(active_display, res_type);
857
858 if (res_type == RES_TYPE_PIXELMAP)
859 {
860 start_id++;
861 end_id++;
862 }
863
864 int active_theme = mpProject->mDisplays[active_display].active_theme;
865
866 for (res_id = start_id; res_id < end_id; res_id++)
867 {
868 res_info *info = mpProject->FindResource(active_display, active_theme, res_type, res_id);
869
870 if (info)
871 {
872 list_index = pBox->AddString(info->name);
873 pBox->SetItemData(list_index, res_id);
874 }
875 }
876
877 if (res_type == RES_TYPE_PIXELMAP)
878 {
879 pBox->InsertString(0, _T("None"));
880 pBox->SetItemData(0, 0);
881 }
882
883 SelectDropListItem(pBox, current_val);
884 m_top_pos += m_row_height;
885 }
886
887 ///////////////////////////////////////////////////////////////////////////////
AddStringSelect(int current_val)888 void properties_win::AddStringSelect(int current_val)
889 {
890 int right;
891 int box_index;
892 CRect size;
893 CString cs("String ID");
894 GetClientRect(&size);
895
896 size.top += m_top_pos;
897 size.left += PROPERTY_ITEM_SPACE;
898 size.right -= PROPERTY_ITEM_SPACE;
899 right = size.right;
900 size.right = size.left + m_leftcol_width;
901 size.bottom = size.top + m_item_height;
902
903 CStatic *pDesc = new CStatic();
904 pDesc->Create(cs, WS_CHILD|SS_LEFT, size, this);
905
906 size.top -= 2;
907 size.left = size.right + 1;
908 size.right = right;
909 size.bottom = size.top + 200;
910
911 CComboBox *pBox = new CComboBox();
912 pBox->Create(WS_CHILD|WS_TABSTOP|WS_VSCROLL|CBS_DROPDOWNLIST|SORT_FLAG, size, this, ID_STRING_ID);
913
914 int string_id = 1;
915 string_table *table = GetActiveStringTable();
916
917 int string_ref = 0;
918
919 if (table)
920 {
921
922 if (current_val >= 0 && current_val < table->CountStrings())
923 {
924 string_ref = current_val;
925 }
926
927 while(string_id < table->CountStrings())
928 {
929 box_index = pBox->AddString(table->GetResourceIdName(string_id));
930 pBox->SetItemData(box_index, string_id);
931 string_id++;
932 }
933 CString id_name = table->GetResourceIdName(string_ref);
934 m_top_pos += m_row_height;
935 AddRichEditControl("Text", table->GetString(id_name), ID_STRING_VAL);
936 }
937
938 pBox->InsertString(0, _T("None"));
939 pBox->SetItemData(0, 0);
940
941 SelectDropListItem(pBox, string_ref);
942 }
943
944
945 ///////////////////////////////////////////////////////////////////////////////
AddComboBox(char * label,STRING_VAL_PAIR * list,int id,ULONG current_val)946 void properties_win::AddComboBox(char *label, STRING_VAL_PAIR *list, int id,
947 ULONG current_val)
948 {
949 int right;
950 CRect size;
951 CString cs(label);
952 GetClientRect(&size);
953
954 size.top += m_top_pos;
955 size.left += PROPERTY_ITEM_SPACE;
956 size.right -= PROPERTY_ITEM_SPACE;
957 right = size.right;
958 size.right = size.left + m_leftcol_width;
959 size.bottom = size.top + m_item_height;
960
961 CStatic *pDesc = new CStatic();
962 pDesc->Create(cs, WS_CHILD|SS_LEFT, size, this);
963
964 size.top -= 2;
965 size.left = size.right + 1;
966 size.right = right;
967 size.bottom = size.top + 200;
968
969 express_combobox *pBox = new express_combobox();
970 pBox->Create(WS_CHILD|WS_TABSTOP|CBS_DROPDOWNLIST, size, this, id);
971
972 STRING_VAL_PAIR *current = list;
973 int index;
974 int sel_index = -1;
975
976 while(current->name.GetLength())
977 {
978 index = pBox->AddString(current->name);
979 pBox->SetItemData(index, current->val);
980
981 if (current->val == current_val)
982 {
983 sel_index = index;
984 }
985 current++;
986 }
987
988 if (id == ID_RADIAL_SLIDER_ANIMATION_STYLE)
989 {
990 pBox->InsertString(0, _T("None"));
991 pBox->SetItemData(0, 0);
992 }
993
994 SelectDropListItem(pBox, current_val);
995
996 pBox->ShowWindow(SW_SHOW);
997
998 m_top_pos += m_row_height;
999 }
1000
1001 ///////////////////////////////////////////////////////////////////////////////
AddRadioButton(char * description,ULONG checked,int id)1002 CButton *properties_win::AddRadioButton(char *description, ULONG checked, int id)
1003 {
1004 int right;
1005 CRect size;
1006 CRect groupsize;
1007 CString cs(description);
1008 GetClientRect(&size);
1009
1010 size.top += m_top_pos;
1011 size.left += PROPERTY_ITEM_SPACE;
1012 size.right -= PROPERTY_ITEM_SPACE;
1013 right = size.right;
1014 size.right = size.left + m_leftcol_width;
1015 size.bottom = size.top + m_item_height;
1016
1017 CStatic *pDesc = new CStatic();
1018 pDesc->Create(cs, WS_CHILD|SS_LEFT, size, this);
1019
1020 size.left = size.right + 1;
1021 size.right = right;
1022
1023 CButton *pButton = new CButton();
1024 pButton->Create(NULL, WS_CHILD|WS_TABSTOP|BS_AUTORADIOBUTTON, size, this, id);
1025
1026 if (checked)
1027 {
1028 pButton->SetCheck(BST_CHECKED);
1029 }
1030 else
1031 {
1032 pButton->SetCheck(BST_UNCHECKED);
1033 }
1034
1035 m_top_pos += m_row_height;
1036 return pButton;
1037 }
1038
1039 ///////////////////////////////////////////////////////////////////////////////
AddCheckBox(char * description,ULONG checked,int id)1040 CButton *properties_win::AddCheckBox(char *description, ULONG checked, int id)
1041 {
1042 CRect size;
1043 CString cs(description);
1044 GetClientRect(&size);
1045
1046 size.top += m_top_pos;
1047 size.left += PROPERTY_ITEM_SPACE;
1048 size.right -= PROPERTY_ITEM_SPACE;
1049 size.bottom = size.top + m_item_height;
1050
1051 CButton *pButton = new CButton();
1052 pButton->Create(cs, WS_CHILD|WS_TABSTOP|BS_LEFTTEXT|BS_AUTOCHECKBOX, size, this, id);
1053
1054 if (checked)
1055 {
1056 pButton->SetCheck(BST_CHECKED);
1057 }
1058 else
1059 {
1060 pButton->SetCheck(BST_UNCHECKED);
1061 }
1062
1063 m_top_pos += m_row_height;
1064 return pButton;
1065 }
1066
1067 ///////////////////////////////////////////////////////////////////////////////
AddPushButton(char * description,int id)1068 void properties_win::AddPushButton(char *description, int id)
1069 {
1070 CRect size;
1071 CString cs(description);
1072 GetClientRect(&size);
1073
1074 size.top += m_top_pos;
1075 size.left += PROPERTY_ITEM_SPACE;
1076 size.right -= PROPERTY_ITEM_SPACE;
1077 size.bottom = size.top + m_item_height + 4;
1078
1079 CButton *pButton = new CButton();
1080 pButton->Create(cs, WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, size, this, id);
1081
1082 m_top_pos += m_row_height + 4;
1083 }
1084
1085
1086 ///////////////////////////////////////////////////////////////////////////////
AddEditControl(char * description,int value,int id)1087 void properties_win::AddEditControl(char *description, int value, int id)
1088 {
1089 CString valstring;
1090 valstring.Format(_T("%d"), value);
1091 AddEditControl(description, valstring, id);
1092 }
1093
1094
1095 ///////////////////////////////////////////////////////////////////////////////
AddEditControl(char * description,CString & name,int id)1096 void properties_win::AddEditControl(char *description, CString &name, int id)
1097 {
1098 int right;
1099 CRect size;
1100 CString cs(description);
1101 GetClientRect(&size);
1102
1103 size.left += PROPERTY_ITEM_SPACE;
1104 size.right -= PROPERTY_ITEM_SPACE;
1105
1106 right = size.right;
1107
1108 size.top += m_top_pos;
1109 size.bottom = size.top + m_item_height;
1110 size.right = size.left + m_leftcol_width;
1111
1112 CStatic *pDesc = new CStatic();
1113 pDesc->Create(cs, WS_CHILD|SS_LEFT, size, this);
1114
1115 size.left = size.right + 1;
1116 size.right = right;
1117
1118 CEdit *pEdit = new CEdit();
1119 pEdit->Create(WS_CHILD|WS_TABSTOP|SS_LEFT|ES_AUTOHSCROLL, size, this, id);
1120 pEdit->SetWindowText(name);
1121
1122 m_top_pos += m_row_height;
1123 }
1124
1125 ///////////////////////////////////////////////////////////////////////////////
AddRichEditControl(char * description,CString & name,int id)1126 void properties_win::AddRichEditControl(char *description, CString &name, int id)
1127 {
1128 int right;
1129 CRect size;
1130 CString cs(description);
1131 GetClientRect(&size);
1132
1133 size.left += PROPERTY_ITEM_SPACE;
1134 size.right -= PROPERTY_ITEM_SPACE;
1135
1136 right = size.right;
1137
1138 size.top += m_top_pos;
1139 size.bottom = size.top + m_item_height;
1140 size.right = size.left + m_leftcol_width;
1141
1142 CStatic *pDesc = new CStatic();
1143 pDesc->Create(cs, WS_CHILD|SS_LEFT, size, this);
1144
1145 size.left = size.right + 1;
1146 size.right = right;
1147
1148 CRichEditCtrl *pEdit = new CRichEditCtrl();
1149
1150 int style = WS_CHILD | WS_TABSTOP | SS_LEFT | ES_AUTOHSCROLL;
1151 if (id == ID_STRING_VAL)
1152 {
1153 style |= ES_MULTILINE | ES_AUTOVSCROLL;
1154 }
1155 pEdit->Create(style, size, this, id);
1156 //pEdit->SetWindowText(name);
1157 SetUtf8Text(pEdit, name);
1158
1159 SetAccessibleHelpString(pEdit->GetSafeHwnd(), name);
1160 m_top_pos += m_row_height;
1161 }
1162
1163
1164 ///////////////////////////////////////////////////////////////////////////////
AddPromptControl(char * description,CString & name)1165 void properties_win::AddPromptControl(char *description, CString &name)
1166 {
1167 int right;
1168 CRect size;
1169 CString cs(description);
1170 GetClientRect(&size);
1171
1172 size.left += PROPERTY_ITEM_SPACE;
1173 size.right -= PROPERTY_ITEM_SPACE;
1174
1175 right = size.right;
1176
1177 size.top += m_top_pos;
1178 size.bottom = size.top + m_item_height;
1179 size.right = size.left + m_leftcol_width;
1180
1181 CStatic *pDesc = new CStatic();
1182 pDesc->Create(cs, WS_CHILD|SS_LEFT, size, this);
1183
1184 size.left = size.right + 1;
1185 size.right = right;
1186
1187 CStatic *pval = new CStatic();
1188 pval->Create(name, WS_CHILD|SS_LEFT, size, this);
1189
1190 m_top_pos += m_row_height;
1191 }
1192
1193 ///////////////////////////////////////////////////////////////////////////////
CreateGroup(char * caption,int rows)1194 CButton *properties_win::CreateGroup(char *caption, int rows)
1195 {
1196 CRect size;
1197 CString cs(caption);
1198 GetClientRect(&size);
1199
1200 size.left += PROPERTY_ITEM_SPACE;
1201 size.right -= PROPERTY_ITEM_SPACE;
1202 size.top += m_top_pos;
1203 size.bottom = size.top + ((rows + 1) * m_row_height);
1204 CButton *group = new CButton;
1205 group->Create(cs, WS_CHILD|BS_GROUPBOX, size, this, 0);
1206 m_group_pos = m_row_height;
1207 m_top_pos += ((rows + 2) * m_row_height);
1208 return group;
1209 }
1210
1211
1212 ///////////////////////////////////////////////////////////////////////////////
AddWidgetProps()1213 void properties_win::AddWidgetProps()
1214 {
1215 CButton *box;
1216
1217 AddPromptControl("Widget Type", mpInfo->base_name);
1218 AddEditControl("Widget Name", mpInfo->app_name, ID_WIDGET_NAME);
1219 AddEditControl("Widget Id", mpInfo->id_name, ID_WIDGET_ID);
1220 AddEditControl("User Data", mpInfo->user_data, ID_USER_DATA);
1221
1222 if (mpInfo->basetype != GX_TYPE_RADIAL_PROGRESS_BAR)
1223 {
1224 AddEditControl("Left", mpInfo->size.gx_rectangle_left, ID_XPOS);
1225 AddEditControl("Top", mpInfo->size.gx_rectangle_top, ID_YPOS);
1226 }
1227
1228 if (mpInfo->basetype != GX_TYPE_TEMPLATE)
1229 {
1230 if (mpInfo->basetype != GX_TYPE_RADIAL_PROGRESS_BAR)
1231 {
1232 AddEditControl("Width",
1233 mpInfo->size.gx_rectangle_right - mpInfo->size.gx_rectangle_left + 1,
1234 ID_WIDTH);
1235 AddEditControl("Height",
1236 mpInfo->size.gx_rectangle_bottom - mpInfo->size.gx_rectangle_top + 1,
1237 ID_HEIGHT);
1238 }
1239
1240 AddComboBox("Border", border_types, ID_BORDER_COMBO,
1241 mpInfo->style & GX_STYLE_BORDER_MASK);
1242
1243 AddCheckBox("Transparent", mpInfo->style & GX_STYLE_TRANSPARENT, ID_TRANSPARENT);
1244 AddCheckBox("Draw Selected", mpInfo->style & GX_STYLE_DRAW_SELECTED, ID_SELECTED);
1245 }
1246 AddCheckBox("Enabled", mpInfo->style & GX_STYLE_ENABLED, ID_ENABLED);
1247 AddCheckBox("Accepts Focus", mpInfo->accepts_focus, ID_ACCEPTS_FOCUS);
1248
1249 if (mpProject->mHeader.guix_version > 50000)
1250 {
1251 switch(mpInfo->allocation)
1252 {
1253 case STATICALLY_ALLOCATED:
1254 AddCheckBox("Runtime Allocate", FALSE, ID_DYNAMIC_WIDGET);
1255 break;
1256
1257 case DYNAMIC_ALLOCATION_ROOT:
1258 AddCheckBox("Runtime Allocate", TRUE, ID_DYNAMIC_WIDGET);
1259 break;
1260
1261 case DYNAMIC_ALLOCATION_CHILD:
1262 box = AddCheckBox("Runtime Allocate", TRUE, ID_DYNAMIC_WIDGET);
1263 box->EnableWindow(FALSE);
1264 break;
1265
1266 default:
1267 ErrorMsg("Internal error: Invalid allocation parameter");
1268 break;
1269 }
1270 }
1271
1272 if (mpInfo->basetype != GX_TYPE_TEMPLATE)
1273 {
1274 AddComboBox("Normal fill", RES_TYPE_COLOR, ID_NORMAL_COLOR, mpInfo->color_id[NORMAL_FILL_COLOR_INDEX]);
1275 AddComboBox("Selected fill", RES_TYPE_COLOR, ID_SELECTED_COLOR, mpInfo->color_id[SELECTED_FILL_COLOR_INDEX]);
1276 AddComboBox("Disabled fill", RES_TYPE_COLOR, ID_DISABLED_COLOR, mpInfo->color_id[DISABLED_FILL_COLOR_INDEX]);
1277
1278 switch (mpInfo->basetype)
1279 {
1280 case GX_TYPE_SINGLE_LINE_TEXT_INPUT:
1281 case GX_TYPE_MULTI_LINE_TEXT_INPUT:
1282 AddComboBox("Readonly fill", RES_TYPE_COLOR, ID_READONLY_COLOR, mpInfo->color_id[READONLY_FILL_COLOR_INDEX]);
1283 break;
1284 default:
1285 break;
1286 }
1287 }
1288
1289 if (GetProjectView()->IsTopLevelWidget(mpInfo))
1290 {
1291 AddCheckBox("Template", mpInfo->is_template, ID_TEMPLATE);
1292 AddCheckBox("Visible At Startup", mpInfo->visible_at_startup, ID_VISIBLE_AT_STARTUP);
1293 }
1294
1295 AddEditControl("Draw Function", mpInfo->draw_func, ID_DRAW_FUNCTION);
1296 AddEditControl("Event Function", mpInfo->event_func, ID_EVENT_FUNCTION);
1297 }
1298
1299 ///////////////////////////////////////////////////////////////////////////////
AddTextWidgetProperties(widget_info * info)1300 void properties_win::AddTextWidgetProperties(widget_info *info)
1301 {
1302 AddStringSelect(info->string_id[0]);
1303 AddComboBox("Font", RES_TYPE_FONT, ID_FONT_SELECT_0, info->font_id[0]);
1304 AddComboBox("Text Align", text_align_styles, ID_TEXT_ALIGN, info->style & GX_STYLE_TEXT_ALIGNMENT_MASK);
1305 AddComboBox("Normal Text Color", RES_TYPE_COLOR, ID_NORMAL_TEXT_COLOR, info->color_id[NORMAL_TEXT_COLOR_INDEX]);
1306 AddComboBox("Selected Text Color", RES_TYPE_COLOR, ID_SELECTED_TEXT_COLOR, info->color_id[SELECTED_TEXT_COLOR_INDEX]);
1307 AddComboBox("Disabled Text Color", RES_TYPE_COLOR, ID_DISABLED_TEXT_COLOR, info->color_id[DISABLED_TEXT_COLOR_INDEX]);
1308 }
1309
1310 ///////////////////////////////////////////////////////////////////////////////
AddTextCopyProperty(widget_info * info)1311 void properties_win::AddTextCopyProperty(widget_info *info)
1312 {
1313 AddCheckBox("Private Text Copy", info->style & GX_STYLE_TEXT_COPY, ID_TEXT_COPY);
1314 }
1315
AddNumericPromptProps(widget_info * info)1316 void properties_win::AddNumericPromptProps(widget_info *info)
1317 {
1318 AddEditControl("Numeric Value", info->ewi.numeric_prompt_value, ID_NUMERIC_PROMPT_VALUE);
1319 AddEditControl("Format Func", info->format_func, ID_FORMAT_FUNC);
1320 }
1321
1322 ///////////////////////////////////////////////////////////////////////////////
AddTextInputProperties(widget_info * info)1323 void properties_win::AddTextInputProperties(widget_info *info)
1324 {
1325 AddTextWidgetProperties(info);
1326 AddComboBox("Readonly Text Color", RES_TYPE_COLOR, ID_READONLY_TEXT_COLOR, info->color_id[READONLY_TEXT_COLOR_INDEX]);
1327 AddCheckBox("Read Only", info->style & GX_STYLE_TEXT_INPUT_READONLY, ID_TEXT_INPUT_READONLY);
1328 AddEditControl("Buffer Size", mpInfo->ewi.text_info.buffer_size, ID_BUFFER_SIZE);
1329 AddCheckBox("Dynamic Buffer", mpInfo->ewi.text_info.dynamic_buffer, ID_DYNAMIC_BUFFER);
1330 AddEditControl("Allocator", mpInfo->callback_func, ID_CALLBACK_NAME);
1331 }
1332
1333 ///////////////////////////////////////////////////////////////////////////////
AddMLTextViewProperties(widget_info * info)1334 void properties_win::AddMLTextViewProperties(widget_info *info)
1335 {
1336 AddTextWidgetProperties(info);
1337 AddTextCopyProperty(info);
1338 AddCheckBox("Center Text Vertically", info->style & GX_STYLE_VALIGN_CENTER, ID_ML_TEXT_VCENTER);
1339 AddEditControl("Whitespace", mpInfo->ewi.text_info.whitespace, ID_TEXT_VIEW_WHITESPACE);
1340 AddEditControl("Line Space", mpInfo->ewi.text_info.line_space, ID_TEXT_VIEW_LINE_SPACE);
1341 }
1342
1343 ///////////////////////////////////////////////////////////////////////////////
AddMLTextInputProperties(widget_info * info)1344 void properties_win::AddMLTextInputProperties(widget_info *info)
1345 {
1346 AddTextWidgetProperties(info);
1347 AddComboBox("Readonly Text Color", RES_TYPE_COLOR, ID_READONLY_TEXT_COLOR, info->color_id[READONLY_TEXT_COLOR_INDEX]);
1348 AddCheckBox("Read Only", info->style & GX_STYLE_TEXT_INPUT_READONLY, ID_TEXT_INPUT_READONLY);
1349 AddEditControl("Whitespace", mpInfo->ewi.text_info.whitespace, ID_TEXT_VIEW_WHITESPACE);
1350 AddEditControl("Line Space", mpInfo->ewi.text_info.line_space, ID_TEXT_VIEW_LINE_SPACE);
1351
1352 AddEditControl("Buffer Size", mpInfo->ewi.text_info.buffer_size, ID_BUFFER_SIZE);
1353 AddCheckBox("Dynamic Buffer", mpInfo->ewi.text_info.dynamic_buffer, ID_DYNAMIC_BUFFER);
1354 AddEditControl("Allocator", mpInfo->callback_func, ID_CALLBACK_NAME);
1355 }
1356
AddRichTextViewProperties(widget_info * info)1357 void properties_win::AddRichTextViewProperties(widget_info *info)
1358 {
1359 AddStringSelect(info->string_id[0]);
1360 AddPushButton("Edit Rich Text", ID_RICH_TEXT_VIEW_TEXT_EDIT);
1361
1362 AddComboBox("Text Align", text_align_styles, ID_TEXT_ALIGN, info->style & GX_STYLE_TEXT_ALIGNMENT_MASK);
1363 AddComboBox("Normal Font", RES_TYPE_FONT, ID_FONT_SELECT_0, info->font_id[RICH_TEXT_FONT_NORMAL]);
1364 AddComboBox("Bold Font", RES_TYPE_FONT, ID_FONT_SELECT_1, info->font_id[RICH_TEXT_FONT_BOLD]);
1365 AddComboBox("Italic Font", RES_TYPE_FONT, ID_FONT_SELECT_2, info->font_id[RICH_TEXT_FONT_ITALIC]);
1366 AddComboBox("Bold Italic Font", RES_TYPE_FONT, ID_FONT_SELECT_3, info->font_id[RICH_TEXT_FONT_BOLD_ITALIC]);
1367
1368 AddComboBox("Normal Text Color", RES_TYPE_COLOR, ID_NORMAL_TEXT_COLOR, info->color_id[NORMAL_TEXT_COLOR_INDEX]);
1369 AddComboBox("Selected Text Color", RES_TYPE_COLOR, ID_SELECTED_TEXT_COLOR, info->color_id[SELECTED_TEXT_COLOR_INDEX]);
1370 AddComboBox("Disabled Text Color", RES_TYPE_COLOR, ID_DISABLED_TEXT_COLOR, info->color_id[DISABLED_TEXT_COLOR_INDEX]);
1371
1372 AddTextCopyProperty(info);
1373 AddEditControl("Whitespace", mpInfo->ewi.text_info.whitespace, ID_TEXT_VIEW_WHITESPACE);
1374 AddEditControl("Line Space", mpInfo->ewi.text_info.line_space, ID_TEXT_VIEW_LINE_SPACE);
1375 }
1376
1377
1378 ///////////////////////////////////////////////////////////////////////////////
AddButtonStyles(widget_info * info)1379 void properties_win::AddButtonStyles(widget_info *info)
1380 {
1381 AddCheckBox("Pushed", info->style & GX_STYLE_BUTTON_PUSHED, ID_BUTTON_STYLE_PUSHED);
1382 AddCheckBox("Toggle", info->style & GX_STYLE_BUTTON_TOGGLE, ID_BUTTON_STYLE_TOGGLE);
1383 AddCheckBox("Radio", info->style & GX_STYLE_BUTTON_RADIO, ID_BUTTON_STYLE_RADIO);
1384 AddCheckBox("Auto Repeat", info->style & GX_STYLE_BUTTON_REPEAT, ID_BUTTON_STYLE_REPEAT);
1385
1386 /* FIXME get these added at some point */
1387 //#define GX_STYLE_BUTTON_EVENT_ON_PUSH 0x00000080
1388 }
1389
1390
1391 ///////////////////////////////////////////////////////////////////////////////
1392 // for older GUIX library versions, the pixelmap alignment styles may not be
1393 // used. Set them to a reasonable default:
ValidateAlignStyle(INT style)1394 INT properties_win::ValidateAlignStyle(INT style)
1395 {
1396 if ((style & GX_PIXELMAP_HALIGN_MASK) == 0)
1397 {
1398 style |= GX_STYLE_HALIGN_LEFT;
1399 }
1400
1401 if ((style & GX_PIXELMAP_VALIGN_MASK) == 0)
1402 {
1403 style |= GX_STYLE_VALIGN_TOP;
1404 }
1405 return style;
1406 }
1407
1408 ///////////////////////////////////////////////////////////////////////////////
AddPixelmapButtonProps(widget_info * info)1409 void properties_win::AddPixelmapButtonProps(widget_info *info)
1410 {
1411 AddButtonStyles(info);
1412 AddComboBox("Normal Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[NORMAL_PIXELMAP_INDEX]);
1413 AddComboBox("Selected Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_1, info->pixelmap_id[SELECTED_PIXELMAP_INDEX]);
1414 AddComboBox("Disabled Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_2, info->pixelmap_id[DISABLED_PIXELMAP_INDEX]);
1415
1416 INT style = ValidateAlignStyle(info->style);
1417
1418 AddComboBox("Horizontal Align", button_halign_styles, ID_PIXMAP_HALIGN, style & GX_PIXELMAP_HALIGN_MASK);
1419 AddComboBox("Vertical Align", button_valign_styles, ID_PIXMAP_VALIGN, style & GX_PIXELMAP_VALIGN_MASK);
1420 }
1421
1422 ///////////////////////////////////////////////////////////////////////////////
AddCheckboxProps(widget_info * info)1423 void properties_win::AddCheckboxProps(widget_info *info)
1424 {
1425 AddButtonStyles(info);
1426 AddTextWidgetProperties(info);
1427 AddTextCopyProperty(info);
1428
1429 AddComboBox("Unchecked Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[UNCHECKED_PIXELMAP_INDEX]);
1430 AddComboBox("Checked Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_1, info->pixelmap_id[CHECKED_PIXELMAP_INDEX]);
1431 AddComboBox("Unchecked Disabled Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_2, info->pixelmap_id[UNCHECKED_DISABLED_PIXELMAP_INDEX]);
1432 AddComboBox("Checked Disabled Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_3, info->pixelmap_id[CHECKED_DISABLED_PIXELMAP_INDEX]);
1433 }
1434
1435 ///////////////////////////////////////////////////////////////////////////////
AddRadioButtonProps(widget_info * info)1436 void properties_win::AddRadioButtonProps(widget_info *info)
1437 {
1438 AddButtonStyles(info);
1439 AddTextWidgetProperties(info);
1440 AddTextCopyProperty(info);
1441
1442 AddComboBox("Radio Off Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[RADIO_OFF_PIXELMAP_INDEX]);
1443 AddComboBox("Radio On Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_1, info->pixelmap_id[RADIO_ON_PIXELMAP_INDEX]);
1444 AddComboBox("Radio Off Disabled Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_2, info->pixelmap_id[RADIO_OFF_DISABLED_PIXELMAP_INDEX]);
1445 AddComboBox("Radio On Disabled Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_3, info->pixelmap_id[RADIO_ON_DISABLED_PIXELMAP_INDEX]);
1446
1447 }
1448
1449 ///////////////////////////////////////////////////////////////////////////////
AddIconButtonProps(widget_info * info)1450 void properties_win::AddIconButtonProps(widget_info *info)
1451 {
1452 AddButtonStyles(info);
1453 AddComboBox("Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[NORMAL_PIXELMAP_INDEX]);
1454
1455 INT style = ValidateAlignStyle(info->style);
1456
1457 AddComboBox("Horizontal Align", button_halign_styles, ID_PIXMAP_HALIGN, style & GX_PIXELMAP_HALIGN_MASK);
1458 AddComboBox("Vertical Align", button_valign_styles, ID_PIXMAP_VALIGN, style & GX_PIXELMAP_VALIGN_MASK);
1459 }
1460
1461 ///////////////////////////////////////////////////////////////////////////////
AddIconProps(widget_info * info)1462 void properties_win::AddIconProps(widget_info *info)
1463 {
1464 AddComboBox("Normal Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[NORMAL_PIXELMAP_INDEX]);
1465 AddComboBox("Selected Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_1, info->pixelmap_id[SELECTED_PIXELMAP_INDEX]);
1466
1467 INT style = ValidateAlignStyle(info->style);
1468
1469 AddComboBox("Horizontal Align", button_halign_styles, ID_PIXMAP_HALIGN, style & GX_PIXELMAP_HALIGN_MASK);
1470 AddComboBox("Vertical Align", button_valign_styles, ID_PIXMAP_VALIGN, style & GX_PIXELMAP_VALIGN_MASK);
1471 }
1472
1473 ///////////////////////////////////////////////////////////////////////////////
AddPixelmapPromptProps(widget_info * info)1474 void properties_win::AddPixelmapPromptProps(widget_info *info)
1475 {
1476 AddTextWidgetProperties(info);
1477
1478 AddComboBox("Norm Left PixMap", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[LEFT_PIXELMAP_INDEX]);
1479 AddComboBox("Norm Fill PixMap", RES_TYPE_PIXELMAP, ID_PIXELMAP_1, info->pixelmap_id[FILL_PIXELMAP_INDEX]);
1480 AddComboBox("Norm Right PixMap", RES_TYPE_PIXELMAP, ID_PIXELMAP_2, info->pixelmap_id[RIGHT_PIXELMAP_INDEX]);
1481 AddComboBox("Sel Left PixMap", RES_TYPE_PIXELMAP, ID_PIXELMAP_3, info->pixelmap_id[SELECTED_LEFT_PIXELMAP_INDEX]);
1482 AddComboBox("Sel Fill PixMap", RES_TYPE_PIXELMAP, ID_PIXELMAP_4, info->pixelmap_id[SELECTED_FILL_PIXELMAP_INDEX]);
1483 AddComboBox("Sel Right PixMap", RES_TYPE_PIXELMAP, ID_PIXELMAP_5, info->pixelmap_id[SELECTED_RIGHT_PIXELMAP_INDEX]);
1484 }
1485
1486 ///////////////////////////////////////////////////////////////////////////////
AddWindowProps(widget_info * info)1487 void properties_win::AddWindowProps(widget_info *info)
1488 {
1489 AddComboBox("Wallpaper", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[WALLPAPER_PIXELMAP_INDEX]);
1490 AddCheckBox("Tile Wallpaper", info->style & GX_STYLE_TILE_WALLPAPER, ID_TILE_WALLPAPER);
1491 }
1492
1493 ///////////////////////////////////////////////////////////////////////////////
AddVerticalListProps(widget_info * info)1494 void properties_win::AddVerticalListProps(widget_info *info)
1495 {
1496 AddWindowProps(info);
1497 AddCheckBox("Wrap", info->style & GX_STYLE_WRAP, ID_LIST_WRAP);
1498 AddCheckBox("Repeat Select", info->style & GX_STYLE_REPEAT_SELECT, ID_LIST_REPEAT_SELECT);
1499 AddEditControl("Total Rows", info->ewi.vlist.total_rows, ID_LIST_ROWS);
1500 AddEditControl("Callback Function", info->callback_func, ID_CALLBACK_NAME);
1501 }
1502
1503 ///////////////////////////////////////////////////////////////////////////////
AddHorizontalListProps(widget_info * info)1504 void properties_win::AddHorizontalListProps(widget_info *info)
1505 {
1506 AddWindowProps(info);
1507 AddCheckBox("Wrap", info->style & GX_STYLE_WRAP, ID_LIST_WRAP);
1508 AddCheckBox("Repeat Select", info->style & GX_STYLE_REPEAT_SELECT, ID_LIST_REPEAT_SELECT);
1509 AddEditControl("Total Columns", info->ewi.vlist.total_rows, ID_LIST_ROWS);
1510 AddEditControl("Callback Function", info->callback_func, ID_CALLBACK_NAME);
1511 }
1512 ///////////////////////////////////////////////////////////////////////////////
AddDropListProps(widget_info * info)1513 void properties_win::AddDropListProps(widget_info *info)
1514 {
1515 AddComboBox("List Wallpaper", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[WALLPAPER_PIXELMAP_INDEX]);
1516 AddCheckBox("Tile List Wallpaper", info->style & GX_STYLE_TILE_WALLPAPER, ID_TILE_DROP_LIST_POPLIST_WALLPAPER);
1517 AddEditControl("Total Rows", info->ewi.drop_list.total_rows, ID_LIST_ROWS);
1518 AddEditControl("Open Height", info->ewi.drop_list.open_height, ID_OPEN_HEIGHT);
1519 AddComboBox("Background Image", RES_TYPE_PIXELMAP, ID_PIXELMAP_1, info->pixelmap_id[DROP_LIST_PIXELMAP_INDEX]);
1520 AddCheckBox("Tile Background", info->style & GX_STYLE_TILE_BACKGROUND, ID_TILE_DROP_LIST_BACKGROUND);
1521
1522 AddEditControl("Callback Function", info->callback_func, ID_CALLBACK_NAME);
1523 }
1524
1525 ///////////////////////////////////////////////////////////////////////////////
AddChartProps(widget_info * info)1526 void properties_win::AddChartProps(widget_info *info)
1527 {
1528 AddWindowProps(info);
1529
1530 AddEditControl("Data Min Value", info->ewi.line_chart_info.gx_line_chart_min_val, ID_CHART_MIN_VAL);
1531 AddEditControl("Data Max Value", info->ewi.line_chart_info.gx_line_chart_max_val, ID_CHART_MAX_VAL);
1532 AddEditControl("Left Margin", info->ewi.line_chart_info.gx_line_chart_left_margin, ID_CHART_LEFT_MARGIN);
1533 AddEditControl("Top Margin", info->ewi.line_chart_info.gx_line_chart_top_margin, ID_CHART_TOP_MARGIN);
1534 AddEditControl("Right Margin", info->ewi.line_chart_info.gx_line_chart_right_margin, ID_CHART_RIGHT_MARGIN);
1535 AddEditControl("Bottom Margin", info->ewi.line_chart_info.gx_line_chart_bottom_margin, ID_CHART_BOTTOM_MARGIN);
1536 AddEditControl("Num Data Points", info->ewi.line_chart_info.gx_line_chart_max_data_count, ID_CHART_MAX_COUNT);
1537 AddEditControl("Axis Line Width", info->ewi.line_chart_info.gx_line_chart_axis_line_width, ID_CHART_AXIS_WIDTH);
1538 AddEditControl("Data Line Width", info->ewi.line_chart_info.gx_line_chart_data_line_width, ID_CHART_LINE_WIDTH);
1539 AddComboBox("Axis Color", RES_TYPE_COLOR, ID_CHART_AXIS_COLOR, info->ewi.line_chart_info.gx_line_chart_axis_color);
1540 AddComboBox("Data Line Color", RES_TYPE_COLOR, ID_CHART_LINE_COLOR, info->ewi.line_chart_info.gx_line_chart_line_color);
1541 }
1542
1543 ///////////////////////////////////////////////////////////////////////////////
AddScrollWheelProps(widget_info * info)1544 void properties_win::AddScrollWheelProps(widget_info *info)
1545 {
1546 AddWindowProps(info);
1547
1548 AddCheckBox("Wrap", info->style & GX_STYLE_WRAP, ID_LIST_WRAP);
1549 AddComboBox("Selected Background", RES_TYPE_PIXELMAP, ID_PIXELMAP_1, info->pixelmap_id[SCROLL_WHEEL_PIXELMAP_INDEX]);
1550
1551 // The total rows of numeric scroll wheell is determined by value range
1552 AddEditControl("Total Rows", info->ewi.scroll_wheel.total_rows, ID_SCROLL_WHEEL_TOTAL_ROWS);
1553
1554 AddEditControl("Selected Row", info->ewi.scroll_wheel.selected_row, ID_SCROLL_WHEEL_SELECTED_ROW);
1555 AddEditControl("Row Height", info->ewi.scroll_wheel.row_height, ID_SCROLL_WHEEL_ROW_HEIHGT);
1556 AddEditControl("Fade Edge Value", info->ewi.scroll_wheel.start_alpha, ID_SCROLL_WHEEL_START_ALPHA);
1557 AddEditControl("Fade Center Value", info->ewi.scroll_wheel.end_alpha, ID_SCROLL_WHEEL_END_ALPHA);
1558 }
1559
1560 ///////////////////////////////////////////////////////////////////////////////
AddMenuProps(widget_info * info)1561 void properties_win::AddMenuProps(widget_info *info)
1562 {
1563 AddCheckBox("Expanded", info->style & GX_STYLE_MENU_EXPANDED, ID_MENU_EXPANDED);
1564 AddCheckBox("Insert As Menu Item", info->ewi.menu.insert_as_menu_item, ID_MENU_INSERT_MODE);
1565 AddEditControl("Text x Offset", info->ewi.menu.text_x_offset, ID_MENU_TEXT_X_OFFSET);
1566 AddEditControl("Text y Offset", info->ewi.menu.text_y_offset, ID_MENU_TEXT_Y_OFFSET);
1567 }
1568
1569 ///////////////////////////////////////////////////////////////////////////////
AddTextScrollWheelProps(widget_info * info)1570 void properties_win::AddTextScrollWheelProps(widget_info *info)
1571 {
1572 //Add scroll wheel properties
1573 AddScrollWheelProps(info);
1574
1575 // Add extended properties
1576 AddCheckBox("Rounding Transform", info->style & GX_STYLE_TEXT_SCROLL_WHEEL_ROUND, ID_TEXT_SCROLL_WHEEL_ROUND);
1577 AddComboBox("Normal Font", RES_TYPE_FONT, ID_TEXT_SCROLL_WHEEL_NORMAL_FONT, info->font_id[NORMAL_FONT_INDEX]);
1578 AddComboBox("Selected Font", RES_TYPE_FONT, ID_TEXT_SCROLL_WHEEL_SELECTED_FONT, info->font_id[SELECTED_FONT_INDEX]);
1579 AddComboBox("Text Align", text_align_styles, ID_TEXT_ALIGN, info->style & GX_STYLE_TEXT_ALIGNMENT_MASK);
1580 AddComboBox("Normal Text Color", RES_TYPE_COLOR, ID_NORMAL_TEXT_COLOR, info->color_id[NORMAL_TEXT_COLOR_INDEX]);
1581 AddComboBox("Selected Text Color", RES_TYPE_COLOR, ID_SELECTED_TEXT_COLOR, info->color_id[SELECTED_TEXT_COLOR_INDEX]);
1582 AddComboBox("Disabled Text Color", RES_TYPE_COLOR, ID_DISABLED_TEXT_COLOR, info->color_id[DISABLED_TEXT_COLOR_INDEX]);
1583
1584 int display_index = mpProject->GetDisplayIndex(info);
1585
1586 if (display_index < 0)
1587 {
1588 // Invalid display index
1589 return;
1590 }
1591
1592 if (mpProject->mDisplays[display_index].colorformat <= GX_COLOR_FORMAT_8BIT_PALETTE)
1593 {
1594 // Background fading feature is not supported in low depth color format
1595 GetDlgItem(ID_SCROLL_WHEEL_START_ALPHA)->EnableWindow(FALSE);
1596 GetDlgItem(ID_SCROLL_WHEEL_END_ALPHA)->EnableWindow(FALSE);
1597
1598 // Rounding transform feature is not supported in low depth color format
1599 GetDlgItem(ID_TEXT_SCROLL_WHEEL_ROUND)->EnableWindow(FALSE);
1600 }
1601 }
1602
1603 ///////////////////////////////////////////////////////////////////////////////
AddStringScrollWheelProps(widget_info * info)1604 void properties_win::AddStringScrollWheelProps(widget_info *info)
1605 {
1606 // Add text scroll wheel properties
1607 AddTextScrollWheelProps(info);
1608
1609 // Add extended properties
1610 AddTextCopyProperty(info);
1611 AddEditControl("String Get Callback", mpInfo->callback_func, ID_CALLBACK_NAME);
1612 AddPushButton("Edit Strings", ID_STRING_SCROLL_WHEEL_EDIT_STRINGS);
1613
1614 if (mpInfo->callback_func.IsEmpty())
1615 {
1616 GetDlgItem(ID_STRING_SCROLL_WHEEL_EDIT_STRINGS)->EnableWindow(TRUE);
1617 }
1618 else
1619 {
1620 GetDlgItem(ID_STRING_SCROLL_WHEEL_EDIT_STRINGS)->EnableWindow(FALSE);
1621 }
1622 }
1623
1624 ///////////////////////////////////////////////////////////////////////////////
AddNumericScrollWheelProps(widget_info * info)1625 void properties_win::AddNumericScrollWheelProps(widget_info *info)
1626 {
1627 // Add text scroll wheel properties
1628 AddTextScrollWheelProps(info);
1629
1630 AddEditControl("Start Val", mpInfo->ewi.numeric_scroll_wheel.start_val, ID_NUMERIC_SCROLL_WHEEL_START_VAL);
1631 AddEditControl("End Val", mpInfo->ewi.numeric_scroll_wheel.end_val, ID_NUMERIC_SCROLL_WHEEL_END_VAL);
1632 AddEditControl("Value Format Callback", mpInfo->callback_func, ID_CALLBACK_NAME);
1633 }
1634
AddGenericScrollWheelProps(widget_info * info)1635 void properties_win::AddGenericScrollWheelProps(widget_info* info)
1636 {
1637 AddScrollWheelProps(info);
1638
1639 AddEditControl("Callback Function", info->callback_func, ID_CALLBACK_NAME);
1640 }
1641
1642 ///////////////////////////////////////////////////////////////////////////////
AddTreeViewProps(widget_info * info)1643 void properties_win::AddTreeViewProps(widget_info *info)
1644 {
1645 AddWindowProps(info);
1646
1647 AddComboBox("Root Line Color", RES_TYPE_COLOR, ID_TREE_VIEW_ROOT_LINE_COLOR, info->color_id[TREE_VIEW_ROOT_LINE_COLOR_INDEX]);
1648 AddCheckBox("Show Root Lines", info->style & GX_STYLE_TREE_VIEW_SHOW_ROOT_LINES, ID_TREE_VIEW_SHOW_ROOT_LINES);
1649 AddEditControl("Indentation", info->ewi.tree_view_indentation, ID_TREE_VIEW_INDENTATION);
1650 AddComboBox("Expand Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_1, info->pixelmap_id[TREE_VIEW_EXPAND_PIXELMAP_INDEX]);
1651 AddComboBox("Collapse Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_2, info->pixelmap_id[TREE_VIEW_COLLAPSE_PIXELMAP_INDEX]);
1652
1653 }
1654
1655 ///////////////////////////////////////////////////////////////////////////////
AddSliderProps(widget_info * info)1656 void properties_win::AddSliderProps(widget_info *info)
1657 {
1658 AddCheckBox("Vertical", info->style & GX_STYLE_SLIDER_VERTICAL, ID_SLIDER_VERTICAL);
1659
1660 if (info->basetype == GX_TYPE_SLIDER)
1661 {
1662 AddCheckBox("Show Tickmarks", info->style & GX_STYLE_SHOW_TICKMARKS, ID_SHOW_TICKMARKS);
1663 AddEditControl("Tickmark Count", info->misc_value, ID_TICKMARK_COUNT);
1664 }
1665
1666 AddEditControl("Min Value", info->ewi.slider.gx_slider_info_min_val, ID_SLIDER_MINVAL);
1667 AddEditControl("Max Value", info->ewi.slider.gx_slider_info_max_val, ID_SLIDER_MAXVAL);
1668 AddEditControl("Current Value", info->ewi.slider.gx_slider_info_current_val, ID_SLIDER_CURRENTVAL);
1669 AddEditControl("Increment", info->ewi.slider.gx_slider_info_increment, ID_SLIDER_INCREMENT);
1670 AddEditControl("Min Travel", info->ewi.slider.gx_slider_info_min_travel, ID_SLIDER_MINTRAVEL);
1671 AddEditControl("Max Travel", info->ewi.slider.gx_slider_info_max_travel, ID_SLIDER_MAXTRAVEL);
1672 AddEditControl("Needle Width", info->ewi.slider.gx_slider_info_needle_width, ID_SLIDER_NEEDLE_WIDTH);
1673 AddEditControl("Needle Height", info->ewi.slider.gx_slider_info_needle_height, ID_SLIDER_NEEDLE_HEIGHT);
1674 AddEditControl("Needle Inset", info->ewi.slider.gx_slider_info_needle_inset, ID_SLIDER_NEEDLE_INSET);
1675 AddEditControl("Needle Hotspot", info->ewi.slider.gx_slider_info_needle_hotspot_offset, ID_NEEDLE_HOTSPOT);
1676 }
1677
1678 ///////////////////////////////////////////////////////////////////////////////
AddPixelmapSliderProps(widget_info * info)1679 void properties_win::AddPixelmapSliderProps(widget_info *info)
1680 {
1681 AddSliderProps(info);
1682 AddCheckBox("Tile Background", info->style & GX_STYLE_TILE_BACKGROUND, ID_SLIDER_TILE_BKGND);
1683 AddComboBox("Needle Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_2, info->pixelmap_id[NEEDLE_PIXELMAP_INDEX]);
1684 AddComboBox("Lower Background", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[LOWER_PIXELMAP_INDEX]);
1685 AddComboBox("Upper Background", RES_TYPE_PIXELMAP, ID_PIXELMAP_1, info->pixelmap_id[UPPER_PIXELMAP_INDEX]);
1686 }
1687
1688 ///////////////////////////////////////////////////////////////////////////////
AddProgressBarProps(widget_info * info)1689 void properties_win::AddProgressBarProps(widget_info *info)
1690 {
1691 AddCheckBox("Vertical", info->style & GX_STYLE_PROGRESS_VERTICAL, ID_PROGRESS_VERTICAL);
1692 AddCheckBox("Show Text", info->style & GX_STYLE_PROGRESS_TEXT_DRAW, ID_PROGRESS_SHOW_TEXT);
1693 AddCheckBox("Show Percentage", info->style & GX_STYLE_PROGRESS_PERCENT, ID_PROGRESS_PERCENT);
1694
1695 AddEditControl("Min Value", info->ewi.progress.min_val, ID_PROGRESS_MINVAL);
1696 AddEditControl("Max Value", info->ewi.progress.max_val, ID_PROGRESS_MAXVAL);
1697 AddEditControl("Current Value", info->ewi.progress.current_val, ID_PROGRESS_CURRENTVAL);
1698
1699 AddComboBox("Font", RES_TYPE_FONT, ID_FONT_SELECT_0, info->font_id[0]);
1700 AddComboBox("Normal Text Color", RES_TYPE_COLOR, ID_NORMAL_TEXT_COLOR, info->color_id[NORMAL_TEXT_COLOR_INDEX]);
1701 AddComboBox("Selected Text Color", RES_TYPE_COLOR, ID_SELECTED_TEXT_COLOR, info->color_id[SELECTED_TEXT_COLOR_INDEX]);
1702 AddComboBox("Disabled Text Color", RES_TYPE_COLOR, ID_DISABLED_TEXT_COLOR, info->color_id[DISABLED_TEXT_COLOR_INDEX]);
1703
1704 AddComboBox("Fill Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[NORMAL_PIXELMAP_INDEX]);
1705 }
1706
1707 ///////////////////////////////////////////////////////////////////////////////
AddRadialProgressBarProps(widget_info * info)1708 void properties_win::AddRadialProgressBarProps(widget_info *info)
1709 {
1710 GX_RADIAL_PROGRESS_BAR_INFO *bar_info = &info->ewi.radial_progress;
1711
1712 AddCheckBox("Show Text", info->style & GX_STYLE_PROGRESS_TEXT_DRAW, ID_RADIAL_PROGRESS_SHOW_TEXT);
1713 AddCheckBox("Show Percentage", info->style & GX_STYLE_PROGRESS_PERCENT, ID_RADIAL_PROGRESS_PERCENT);
1714 AddCheckBox("Show Background Track", !(info->style & GX_STYLE_RADIAL_PROGRESS_NO_BACKTRACK), ID_RADIAL_PROGRESS_BACKTRACK);
1715 AddCheckBox("Alias", info->style & GX_STYLE_RADIAL_PROGRESS_ALIAS, ID_RADIAL_PROGRESS_ALIAS);
1716 AddCheckBox("Round End", info->style & GX_STYLE_RADIAL_PROGRESS_ROUND, ID_RADIAL_PROGRESS_ROUND);
1717 AddEditControl("X Center", bar_info->gx_radial_progress_bar_info_xcenter, ID_RADIAL_PROGRESS_XCENTER);
1718 AddEditControl("Y Center", bar_info->gx_radial_progress_bar_info_ycenter, ID_RADIAL_PROGRESS_YCENTER);
1719 AddEditControl("Radius", bar_info->gx_radial_progress_bar_info_radius, ID_RADIAL_PROGRESS_RADIUS);
1720 AddEditControl("Anchor Value", bar_info->gx_radial_progress_bar_info_anchor_val, ID_RADIAL_PROGRESS_ANCHORVAL);
1721 AddEditControl("Current Value", bar_info->gx_radial_progress_bar_info_current_val, ID_RADIAL_PROGRESS_CURRENTVAL);
1722 AddEditControl("Normal Brush Width", bar_info->gx_radial_progress_bar_info_normal_brush_width, ID_RADIAL_PROGRESS_NORMAL_BRUSH_WIDTH);
1723 AddEditControl("Selected Brush Width", bar_info->gx_radial_progress_bar_info_selected_brush_width, ID_RADIAL_PROGRESS_SELECTED_BRUSH_WIDTH);
1724
1725 AddComboBox("Font", RES_TYPE_FONT, ID_FONT_SELECT_0, info->font_id[0]);
1726 AddComboBox("Normal Text Color", RES_TYPE_COLOR, ID_NORMAL_TEXT_COLOR, info->color_id[NORMAL_TEXT_COLOR_INDEX]);
1727 AddComboBox("Selected Text Color", RES_TYPE_COLOR, ID_SELECTED_TEXT_COLOR, info->color_id[SELECTED_TEXT_COLOR_INDEX]);
1728 AddComboBox("Disabled Text Color", RES_TYPE_COLOR, ID_DISABLED_TEXT_COLOR, info->color_id[DISABLED_TEXT_COLOR_INDEX]);
1729
1730 AddComboBox("Normal Brush Color", RES_TYPE_COLOR, ID_RADIAL_PROGRESS_NORMAL_BRUSH_COLOR, bar_info->gx_radial_progress_bar_info_normal_brush_color);
1731 AddComboBox("Selected Brush Color", RES_TYPE_COLOR, ID_RADIAL_PROGRESS_SELECTED_BRUSH_COLOR, bar_info->gx_radial_progress_bar_info_selected_brush_color);
1732 }
1733
1734 ///////////////////////////////////////////////////////////////////////////////
AddSpriteProps(widget_info * info)1735 void properties_win::AddSpriteProps(widget_info *info)
1736 {
1737 AddComboBox("Pixelmap ID", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[NORMAL_PIXELMAP_INDEX]);
1738 AddCheckBox("Auto-run", info->style & GX_STYLE_SPRITE_AUTO, ID_SPRITE_AUTO);
1739 AddCheckBox("Continous Loop", info->style & GX_STYLE_SPRITE_LOOP, ID_SPRITE_LOOP);
1740 AddPushButton("Edit Framelist", ID_SPRITE_EDIT_FRAMES);
1741 }
1742
1743 ///////////////////////////////////////////////////////////////////////////////
AddRadialSliderProps(widget_info * info)1744 void properties_win::AddRadialSliderProps(widget_info *info)
1745 {
1746 radial_slider_info *slider_info = &info->ewi.radial_slider;
1747
1748 AddEditControl("X Center", slider_info->xcenter, ID_RADIAL_SLIDER_XCENTER);
1749 AddEditControl("Y Center", slider_info->ycenter, ID_RADIAL_SLIDER_YCENTER);
1750 AddEditControl("Radius", slider_info->radius, ID_RADIAL_SLIDER_RADIUS);
1751 AddEditControl("Track Width", slider_info->track_width, ID_RADIAL_SLIDER_TRACK_WIDTH);
1752 AddEditControl("Needle Offset", slider_info->needle_offset, ID_RADIAL_SLIDER_NEEDLE_OFFSET);
1753 AddEditControl("Current Angle", slider_info->current_angle, ID_RADIAL_SLIDER_CURRENT_ANGLE);
1754 AddEditControl("Min Angle", slider_info->min_angle, ID_RADIAL_SLIDER_MIN_ANGLE);
1755 AddEditControl("Max Angle", slider_info->max_angle, ID_RADIAL_SLIDER_MAX_ANGLE);
1756 AddEditControl("Total Steps", slider_info->animation_total_steps, ID_RADIAL_SLIDER_TOTAL_STEPS);
1757 AddEditControl("Delay", slider_info->animation_delay, ID_RADIAL_SLIDER_DELAY);
1758 AddComboBox("Animation Style", easing_function_list, ID_RADIAL_SLIDER_ANIMATION_STYLE, slider_info->animation_style);
1759 AddEditControl("Animation Callback", info->callback_func, ID_CALLBACK_NAME);
1760 AddComboBox("Normal Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[NORMAL_PIXELMAP_INDEX]);
1761 AddComboBox("Needle Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_2, info->pixelmap_id[NEEDLE_PIXELMAP_INDEX]);
1762 }
1763
1764
1765 ///////////////////////////////////////////////////////////////////////////////
AddScrollbarProps(widget_info * info)1766 void properties_win::AddScrollbarProps(widget_info *info)
1767 {
1768 AddComboBox("Thumb Color", RES_TYPE_COLOR, ID_SCROLL_THUMB_COLOR, info->ewi.scroll.gx_scroll_thumb_color);
1769 AddComboBox("Thumb Border Color", RES_TYPE_COLOR, ID_SCROLL_THUMB_BORDER_COLOR, info->ewi.scroll.gx_scroll_thumb_border_color);
1770 AddComboBox("Thumb Border Style", border_types, ID_SCROLL_THUMB_BORDER_STYLE,
1771 info->ewi.scroll.gx_scroll_thumb_border_style);
1772 AddEditControl("Thumb Width", info->ewi.scroll.gx_scroll_thumb_width, ID_THUMB_WIDTH);
1773 AddEditControl("Thumb Travel Min", info->ewi.scroll.gx_scroll_thumb_travel_min, ID_THUMB_TRAVEL_MIN);
1774 AddEditControl("Thumb Travel Max", info->ewi.scroll.gx_scroll_thumb_travel_max, ID_THUMB_TRAVEL_MAX);
1775
1776 AddComboBox("Button Color", RES_TYPE_COLOR, ID_SCROLL_BUTTON_COLOR, info->ewi.scroll.gx_scroll_button_color);
1777
1778 AddComboBox("Bkgnd Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->ewi.scroll.gx_scroll_fill_pixelmap);
1779 AddComboBox("Thumb Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_1, info->ewi.scroll.gx_scroll_thumb_pixelmap);
1780
1781 if (info->widget->gx_widget_type == GX_TYPE_VERTICAL_SCROLL)
1782 {
1783 AddComboBox("Up Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_2, info->ewi.scroll.gx_scroll_up_pixelmap);
1784 AddComboBox("Down Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_3, info->ewi.scroll.gx_scroll_down_pixelmap);
1785 }
1786 else
1787 {
1788 AddComboBox("Left Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_2, info->ewi.scroll.gx_scroll_up_pixelmap);
1789 AddComboBox("Right Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_3, info->ewi.scroll.gx_scroll_down_pixelmap);
1790 }
1791 AddCheckBox("End Buttons", info ->style & GX_SCROLLBAR_END_BUTTONS, ID_SCROLL_END_BUTTONS);
1792 AddCheckBox("Tile Background", info->style & GX_STYLE_TILE_BACKGROUND, ID_SCROLL_TILE_BKGND);
1793 AddCheckBox("Relative Thumb Size", info ->style & GX_SCROLLBAR_RELATIVE_THUMB, ID_SCROLL_RELATIVE_THUMB);
1794 // AddCheckBox("Use as Default", info->style & GX_SCROLLBAR_IS_DEFAULT, ID_SCROLL_IS_DEFAULT);
1795 }
1796
1797 ///////////////////////////////////////////////////////////////////////////////
AddGaugeProps(widget_info * info)1798 void properties_win::AddGaugeProps(widget_info *info)
1799 {
1800 AddEditControl("Start Angle", info->ewi.gauge.start_angle, ID_GAUGE_START_ANGLE);
1801 AddEditControl("Animation Steps", info->ewi.gauge.info.gx_circular_gauge_info_animation_steps, ID_GAUGE_ANIMATION_STEPS);
1802 AddEditControl("Animation Delay", info->ewi.gauge.info.gx_circular_gauge_info_animation_delay, ID_GAUGE_ANIMATION_DELAY);
1803 AddEditControl("Needle Xpos", info->ewi.gauge.info.gx_circular_gauge_info_needle_xpos, ID_GAUGE_NEEDLE_XPOS);
1804 AddEditControl("Needle Ypos", info->ewi.gauge.info.gx_circular_gauge_info_needle_ypos, ID_GAUGE_NEEDLE_YPOS);
1805 AddEditControl("Needle Xcor", info->ewi.gauge.info.gx_circular_gauge_info_needle_xcor, ID_GAUGE_NEEDLE_XCOR);
1806 AddEditControl("Needle Ycor", info->ewi.gauge.info.gx_circular_gauge_info_needle_ycor, ID_GAUGE_NEEDLE_YCOR);
1807 AddComboBox("Normal Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_0, info->pixelmap_id[NORMAL_PIXELMAP_INDEX]);
1808 AddComboBox("Selected Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_1, info->pixelmap_id[SELECTED_PIXELMAP_INDEX]);
1809 AddComboBox("Needle Pixelmap", RES_TYPE_PIXELMAP, ID_PIXELMAP_2, info->pixelmap_id[NEEDLE_PIXELMAP_INDEX]);
1810 }
1811
1812
1813
1814 ///////////////////////////////////////////////////////////////////////////////
1815 // this function is called by the target screen when the user drags the selected
1816 // widget. Update the properties values.
WidgetWasMoved()1817 void properties_win::WidgetWasMoved()
1818 {
1819 CString val;
1820
1821 if (mpInfo)
1822 {
1823 if (mpInfo->widget->gx_widget_type == GX_TYPE_RADIAL_PROGRESS_BAR)
1824 {
1825
1826 val.Format(_T("%d"), mpInfo->ewi.radial_progress.gx_radial_progress_bar_info_xcenter);
1827 SetDlgItemText(ID_RADIAL_PROGRESS_XCENTER, val);
1828
1829 val.Format(_T("%d"), mpInfo->ewi.radial_progress.gx_radial_progress_bar_info_ycenter);
1830 SetDlgItemText(ID_RADIAL_PROGRESS_YCENTER, val);
1831
1832 val.Format(_T("%d"), mpInfo->ewi.radial_progress.gx_radial_progress_bar_info_radius);
1833 SetDlgItemText(ID_RADIAL_PROGRESS_RADIUS, val);
1834 }
1835 else
1836 {
1837 val.Format(_T("%d"), mpInfo->size.gx_rectangle_left);
1838 SetDlgItemText(ID_XPOS, val);
1839
1840 val.Format(_T("%d"), mpInfo->size.gx_rectangle_top);
1841 SetDlgItemText(ID_YPOS, val);
1842
1843 val.Format(_T("%d"),
1844 mpInfo->size.gx_rectangle_right - mpInfo->size.gx_rectangle_left + 1);
1845 SetDlgItemText(ID_WIDTH, val);
1846
1847 val.Format(_T("%d"),
1848 mpInfo->size.gx_rectangle_bottom - mpInfo->size.gx_rectangle_top + 1);
1849 SetDlgItemText(ID_HEIGHT, val);
1850 }
1851
1852 mpProject->SetModified();
1853 }
1854 }
1855
1856 ///////////////////////////////////////////////////////////////////////////////
WidgetWasModified(widget_info * info)1857 void properties_win::WidgetWasModified(widget_info *info)
1858 {
1859 // if the modified widget is the widget that I have displayed,
1860 // then update all my child fields.
1861 if (info == mpInfo)
1862 {
1863 OnWidgetSelect(info);
1864 mpProject->SetModified();
1865 }
1866 }
1867
1868 ///////////////////////////////////////////////////////////////////////////////
WidgetWasModified(GX_WIDGET * widget)1869 void properties_win::WidgetWasModified(GX_WIDGET *widget)
1870 {
1871 // if the modified widget is the widget that I have displayed,
1872 // then update all my child fields.
1873 if (mpInfo && mpProject)
1874 {
1875 if (mpInfo->widget == widget)
1876 {
1877 OnWidgetSelect(mpInfo);
1878 mpProject->SetModified();
1879 }
1880 }
1881 }
1882
1883 ///////////////////////////////////////////////////////////////////////////////
ResourcesChanged()1884 void properties_win::ResourcesChanged()
1885 {
1886 if (mpInfo)
1887 {
1888 OnWidgetSelect(mpInfo);
1889 }
1890 }
1891
1892 ///////////////////////////////////////////////////////////////////////////////
OnWidgetSelect(widget_info * info)1893 void properties_win::OnWidgetSelect(widget_info *info)
1894 {
1895 ShowWindow(SW_HIDE);
1896
1897 //send a kill focus message to the current focus owner
1898 SendEditFocusLoseMessage();
1899
1900 DestroyChildren();
1901 CRect rect;
1902 CRect winrect;
1903 mpInfo = info;
1904 mpProject = NULL;
1905
1906 if (info)
1907 {
1908 mpProject = GetOpenProject();
1909
1910 int scrollpos = m_scroll_helper->GetScrollPos().cy;
1911 m_scroll_helper->ScrollToOrigin(0, TRUE);
1912 int istart = 3;
1913 m_top_pos = istart;
1914
1915 if (GetProjectView()->GetActiveDisplay() >= 0)
1916 {
1917 GetClientRect(&rect);
1918 GetWindowRect(&winrect);
1919
1920 //m_top_pos = rect.top + 3;
1921
1922 AddWidgetProps();
1923
1924 switch(info->basetype)
1925 {
1926 case GX_TYPE_PROMPT:
1927 AddTextWidgetProperties(info);
1928 AddTextCopyProperty(info);
1929 break;
1930
1931 case GX_TYPE_NUMERIC_PROMPT:
1932 AddTextWidgetProperties(info);
1933 AddNumericPromptProps(info);
1934 break;
1935
1936 case GX_TYPE_BUTTON:
1937 AddButtonStyles(info);
1938 break;
1939
1940 case GX_TYPE_TEXT_BUTTON:
1941 case GX_TYPE_MULTI_LINE_TEXT_BUTTON:
1942 AddButtonStyles(info);
1943 AddTextWidgetProperties(info);
1944 AddTextCopyProperty(info);
1945 break;
1946
1947 case GX_TYPE_CHECKBOX:
1948 AddCheckboxProps(info);
1949 break;
1950
1951 case GX_TYPE_RADIO_BUTTON:
1952 AddRadioButtonProps(info);
1953 break;
1954
1955 case GX_TYPE_ICON_BUTTON:
1956 AddIconButtonProps(info);
1957 break;
1958
1959 case GX_TYPE_PIXELMAP_BUTTON:
1960 AddPixelmapButtonProps(info);
1961 break;
1962
1963 case GX_TYPE_ICON:
1964 AddIconProps(info);
1965 break;
1966
1967 case GX_TYPE_PIXELMAP_PROMPT:
1968 AddPixelmapPromptProps(info);
1969 AddTextCopyProperty(info);
1970 break;
1971
1972 case GX_TYPE_NUMERIC_PIXELMAP_PROMPT:
1973 AddPixelmapPromptProps(info);
1974 AddNumericPromptProps(info);
1975 break;
1976
1977 case GX_TYPE_SLIDER:
1978 AddSliderProps(info);
1979 break;
1980
1981 case GX_TYPE_PIXELMAP_SLIDER:
1982 AddPixelmapSliderProps(info);
1983 break;
1984
1985 case GX_TYPE_RADIAL_SLIDER:
1986 AddRadialSliderProps(info);
1987 break;
1988
1989 case GX_TYPE_PROGRESS_BAR:
1990 AddProgressBarProps(info);
1991 break;
1992
1993 case GX_TYPE_RADIAL_PROGRESS_BAR:
1994 AddRadialProgressBarProps(info);
1995 break;
1996
1997 case GX_TYPE_SPRITE:
1998 AddSpriteProps(info);
1999 break;
2000
2001 case GX_TYPE_WINDOW:
2002 AddWindowProps(info);
2003 break;
2004
2005 case GX_TYPE_VERTICAL_LIST:
2006 AddVerticalListProps(info);
2007 break;
2008
2009 case GX_TYPE_HORIZONTAL_LIST:
2010 AddHorizontalListProps(info);
2011 break;
2012
2013 case GX_TYPE_DROP_LIST:
2014 AddDropListProps(info);
2015 break;
2016
2017 case GX_TYPE_LINE_CHART:
2018 AddChartProps(info);
2019 break;
2020
2021 case GX_TYPE_STRING_SCROLL_WHEEL:
2022 AddStringScrollWheelProps(info);
2023 break;
2024
2025 case GX_TYPE_NUMERIC_SCROLL_WHEEL:
2026 AddNumericScrollWheelProps(info);
2027 break;
2028
2029 case GX_TYPE_GENERIC_SCROLL_WHEEL:
2030 AddGenericScrollWheelProps(info);
2031 break;
2032
2033 case GX_TYPE_SINGLE_LINE_TEXT_INPUT:
2034 AddTextInputProperties(info);
2035 break;
2036
2037 case GX_TYPE_MULTI_LINE_TEXT_VIEW:
2038 AddMLTextViewProperties(info);
2039 break;
2040
2041 case GX_TYPE_MULTI_LINE_TEXT_INPUT:
2042 AddMLTextInputProperties(info);
2043 break;
2044
2045 case GX_TYPE_RICH_TEXT_VIEW:
2046 AddRichTextViewProperties(info);
2047 break;
2048
2049 case GX_TYPE_VERTICAL_SCROLL:
2050 case GX_TYPE_HORIZONTAL_SCROLL:
2051 AddScrollbarProps(info);
2052 break;
2053
2054 case GX_TYPE_CIRCULAR_GAUGE:
2055 AddGaugeProps(info);
2056 break;
2057
2058 case GX_TYPE_MENU:
2059 AddPixelmapPromptProps(info);
2060 AddMenuProps(info);
2061 AddTextCopyProperty(info);
2062 break;
2063
2064 case GX_TYPE_TREE_VIEW:
2065 AddTreeViewProps(info);
2066 break;
2067 }
2068 }
2069
2070 /* for some reason the dialog font is not automatically
2071 assigned to dynamically created children, so assign the
2072 font here
2073 */
2074 AssignChildFont();
2075
2076 int display_size = m_top_pos + m_row_height;
2077 int win_size = rect.Height();
2078
2079 m_scroll_helper->SetDisplaySize(0, display_size);
2080
2081 if (display_size > 0)
2082 {
2083 if ((scrollpos > display_size - win_size))
2084 {
2085 scrollpos = display_size - win_size;
2086 }
2087 }
2088 else
2089 {
2090 scrollpos = 0;
2091 }
2092 m_scroll_helper->SetScrollPos(SB_VERT, scrollpos);
2093 }
2094 ShowWindow(SW_SHOW);
2095 }
2096
2097 ///////////////////////////////////////////////////////////////////////////////
ValidateTemplateName(CString & name)2098 void properties_win::ValidateTemplateName(CString &name)
2099 {
2100 if (mpInfo)
2101 {
2102 if (name.IsEmpty())
2103 {
2104 ErrorMsg("Template must have a valid name");
2105
2106 if (mpInfo->app_name.IsEmpty())
2107 {
2108 mpInfo->app_name = CString("Template");
2109 }
2110 name = mpInfo->app_name;
2111 }
2112 SetDlgItemText(ID_WIDGET_NAME, name);
2113 }
2114 }
2115
2116 ///////////////////////////////////////////////////////////////////////////////
OnChangeWidgetName()2117 void properties_win::OnChangeWidgetName()
2118 {
2119 CEdit *edit = (CEdit *)GetDlgItem(ID_WIDGET_NAME);
2120 BOOL save = TRUE;
2121
2122 if (mpProject && mpInfo && edit)
2123 {
2124 CString new_name;
2125
2126 GetDlgItemText(ID_WIDGET_NAME, new_name);
2127
2128 if (new_name != mpInfo->app_name)
2129 {
2130 project_view *view = GetProjectView();
2131 BOOL search_child;
2132
2133 if (view->IsTopLevelWidget(mpInfo))
2134 {
2135 // check for duplicate widget name through top level widgets
2136 folder_info *folder = view->GetRootFolder();
2137
2138 if (folder)
2139 {
2140 search_child = FALSE;
2141
2142 if (widget_factory::FindAppName(folder, new_name, search_child))
2143 {
2144 save = FALSE;
2145 }
2146 }
2147 }
2148 else
2149 {
2150 // check for dupliate widget name through child widgets
2151 widget_info *root = view->FindTopLevelWidget(mpInfo);
2152
2153 if (root)
2154 {
2155 search_child = TRUE;
2156
2157 if (widget_factory::FindAppName(root->GetChildWidgetInfo(), new_name, search_child))
2158 {
2159 save = FALSE;
2160 }
2161 }
2162 }
2163
2164 if (!save)
2165 {
2166 ErrorMsg("Widget name already exists!");
2167 }
2168
2169
2170 new_name = mpInfo->app_name;
2171 if(save && TestInputName(edit, "Widget Name", new_name))
2172 {
2173 if (mpInfo->is_template && widget_factory::FindBaseName(new_name))
2174 {
2175 ErrorMsg("Template name already exists!");
2176
2177 // The template name already exist, revert name change
2178 SetDlgItemText(ID_WIDGET_NAME, mpInfo->app_name);
2179 }
2180 else
2181 {
2182 if (mpInfo->is_template)
2183 {
2184 // Update base type name of derived widgets
2185 template_service_provider::CheckRenameTemplate(mpInfo->app_name, &new_name);
2186 }
2187
2188 UndoManager()->AddEntry(UNDO_TYPE_NAMES, mpInfo);
2189
2190 if (GetProjectView()->IsTopLevelWidget(mpInfo))
2191 {
2192 int display = mpProject->GetDisplayIndex(mpInfo);
2193 if (mpProject->mDisplays[display].screenflow)
2194 {
2195 mpProject->mDisplays[display].screenflow->UpdateScreenName(mpInfo->app_name, new_name);
2196 }
2197 }
2198
2199 // Change widget name
2200 mpInfo->app_name = new_name;
2201
2202 GetProjectView()->NotifyNameChange(mpInfo);
2203
2204 mpProject->SetModified();
2205 }
2206 }
2207 else
2208 {
2209 // Revert to original widget name
2210 SetDlgItemText(ID_WIDGET_NAME, mpInfo->app_name);
2211 }
2212 }
2213 }
2214 }
2215
2216 ///////////////////////////////////////////////////////////////////////////////
CheckChangeWidgetId(CString new_name)2217 BOOL properties_win::CheckChangeWidgetId(CString new_name)
2218 {
2219 int display = mpProject->GetDisplayIndex(mpInfo);
2220 screen_flow *flow = mpProject->mDisplays[display].screenflow;;
2221
2222 if (flow)
2223 {
2224 //old id name has been removed, update id name in screenflow
2225 if (new_name.IsEmpty())
2226 {
2227 project_view *view = GetProjectView();
2228 widget_info *screen_info = NULL;
2229 flow_item *item = NULL;
2230 if (view)
2231 {
2232 //get top level widget info
2233 screen_info = view->FindTopLevelWidget(mpInfo);
2234 }
2235
2236 if (screen_info)
2237 {
2238 //get flow item
2239 item = flow->GetFlowItem(screen_info->app_name);
2240 }
2241
2242 // check if the old id name is reference by a trigger or
2243 // duplicate id name exist
2244 if (flow->FindTrigger(item, mpInfo->id_name) &&
2245 !view->FindWidgetIdName(screen_info, mpInfo, mpInfo->id_name))
2246 {
2247 CString msg;
2248 msg.Format(_T("ID name \"%s\" is referenced by a trigger, remove the id name will invalid the trigger, continue?"), mpInfo->id_name);
2249
2250 if (!AskUser(CT2A(msg)))
2251 {
2252 return FALSE;
2253 }
2254 }
2255 }
2256 else
2257 {
2258 // update id name that referenced by the trigger
2259 mpProject->mDisplays[display].screenflow->UpdateIdName(mpInfo, mpInfo->id_name, new_name);
2260 }
2261 }
2262
2263 return TRUE;
2264 }
2265
2266 ///////////////////////////////////////////////////////////////////////////////
OnChangeWidgetId()2267 void properties_win::OnChangeWidgetId()
2268 {
2269 BOOL Is_Modified = FALSE;
2270 CEdit *edit = (CEdit *)GetDlgItem(ID_WIDGET_ID);
2271
2272 if (mpProject && mpInfo && edit)
2273 {
2274 CString new_name;
2275
2276 /*Check Widget ID.*/
2277 GetDlgItemText(ID_WIDGET_ID, new_name);
2278
2279 if (new_name != mpInfo->id_name)
2280 {
2281 if (new_name.IsEmpty())
2282 {
2283 Is_Modified = TRUE;
2284 }
2285 else
2286 {
2287 new_name = mpInfo->id_name;
2288 if (TestInputName(edit, "Widget Id", new_name))
2289 {
2290 Is_Modified = TRUE;
2291 }
2292 else
2293 {
2294 // revert to original id name
2295 SetDlgItemText(ID_WIDGET_ID, mpInfo->id_name);
2296 }
2297 }
2298
2299 if (Is_Modified)
2300 {
2301 if (!CheckChangeWidgetId(new_name))
2302 {
2303 SetDlgItemText(ID_WIDGET_ID, mpInfo->id_name);
2304 return;
2305 }
2306
2307 UndoManager()->AddEntry(UNDO_TYPE_NAMES, mpInfo);
2308
2309 CString old_id_name = mpInfo->id_name;
2310 // Change widget id name
2311 mpInfo->id_name = new_name;
2312
2313 int display = mpProject->GetDisplayIndex(mpInfo);
2314
2315 if (!new_name.IsEmpty())
2316 {
2317 mpProject->AddToIdDictionary(display, ID_TYPE_WIDGET, new_name);
2318 }
2319
2320 if (!old_id_name.IsEmpty())
2321 {
2322 mpProject->RemoveFromIdDictionary(display, ID_TYPE_WIDGET, old_id_name);
2323 }
2324
2325 mpProject->SetModified();
2326 }
2327 }
2328 }
2329 }
2330 ///////////////////////////////////////////////////////////////////////////////
OnChangeEventFunction()2331 void properties_win::OnChangeEventFunction()
2332 {
2333 BOOL Is_Modified = FALSE;
2334 CEdit *edit = (CEdit *)GetDlgItem(ID_EVENT_FUNCTION);
2335
2336 if (mpProject && mpInfo && edit)
2337 {
2338 CString new_event_func;
2339
2340 /*Check function name.*/
2341 GetDlgItemText(ID_EVENT_FUNCTION, new_event_func);
2342
2343 if (new_event_func != mpInfo->event_func)
2344 {
2345 if (new_event_func.IsEmpty())
2346 {
2347 Is_Modified = TRUE;
2348 }
2349 else
2350 {
2351 new_event_func = mpInfo->event_func;
2352 if (TestInputName(edit, "Event Function", new_event_func))
2353 {
2354 Is_Modified = TRUE;
2355 }
2356 else
2357 {
2358 // revert to original event function
2359 SetDlgItemText(ID_EVENT_FUNCTION, mpInfo->event_func);
2360 }
2361 }
2362
2363 if (Is_Modified)
2364 {
2365 UndoManager()->AddEntry(UNDO_TYPE_NAMES, mpInfo);
2366
2367 // Change widget event function name
2368 mpInfo->event_func = new_event_func;
2369
2370 mpProject->SetModified();
2371 }
2372 }
2373 }
2374 }
2375
2376 ///////////////////////////////////////////////////////////////////////////////
OnChangeDrawFunction()2377 void properties_win::OnChangeDrawFunction()
2378 {
2379 BOOL Is_Modified = FALSE;
2380 CEdit *edit = (CEdit *)GetDlgItem(ID_DRAW_FUNCTION);
2381
2382 if (mpProject && mpInfo && edit)
2383 {
2384 CString new_draw_func;
2385
2386 /*Check function name.*/
2387 GetDlgItemText(ID_DRAW_FUNCTION, new_draw_func);
2388
2389 if (new_draw_func != mpInfo->draw_func)
2390 {
2391 if (new_draw_func.IsEmpty())
2392 {
2393 Is_Modified = TRUE;
2394 }
2395 else
2396 {
2397 new_draw_func = mpInfo->draw_func;
2398 if (TestInputName(edit, "Draw Function", new_draw_func))
2399 {
2400 Is_Modified = TRUE;
2401 }
2402 else
2403 {
2404 // revert to original draw function
2405 SetDlgItemText(ID_DRAW_FUNCTION, mpInfo->draw_func);
2406 }
2407 }
2408
2409 if (Is_Modified)
2410 {
2411 UndoManager()->AddEntry(UNDO_TYPE_NAMES, mpInfo);
2412
2413 // Change widget draw function name
2414 mpInfo->draw_func = new_draw_func;
2415
2416 mpProject->SetModified();
2417 }
2418 }
2419 }
2420 }
2421
2422 ///////////////////////////////////////////////////////////////////////////////
OnChangeWidgetUserData()2423 void properties_win::OnChangeWidgetUserData()
2424 {
2425 if (mpProject && mpInfo && GetDlgItem(ID_USER_DATA))
2426 {
2427 CString data;
2428
2429 GetDlgItemText(ID_USER_DATA, data);
2430
2431 if (data != mpInfo->user_data)
2432 {
2433 UndoManager()->AddEntry(UNDO_TYPE_USER_DATA, mpInfo);
2434
2435 // Update user data
2436 mpInfo->user_data = data;
2437
2438 mpProject->SetModified();
2439 }
2440 }
2441 }
2442
2443 ///////////////////////////////////////////////////////////////////////////////
OnChangeCallbackName()2444 void properties_win::OnChangeCallbackName()
2445 {
2446 CEdit *edit = (CEdit *)GetDlgItem(ID_CALLBACK_NAME);
2447
2448 if (mpProject && mpInfo && edit)
2449 {
2450 CString name;
2451 GX_BOOL Is_Modified = GX_FALSE;
2452
2453 GetDlgItemText(ID_CALLBACK_NAME, name);
2454
2455 if (name != mpInfo->callback_func)
2456 {
2457 if (name.IsEmpty())
2458 {
2459 Is_Modified = TRUE;
2460 }
2461 else
2462 {
2463 name = mpInfo->callback_func;
2464
2465 if (TestInputName(edit, "Callback Function", name))
2466 {
2467 Is_Modified = TRUE;
2468 }
2469 else
2470 {
2471 SetDlgItemText(ID_CALLBACK_NAME, mpInfo->callback_func);
2472 }
2473 }
2474
2475 if (Is_Modified)
2476 {
2477 if (mpInfo->basetype == GX_TYPE_STRING_SCROLL_WHEEL)
2478 {
2479 OnChangeStringScrollWheelProps();
2480 }
2481 else
2482 {
2483 UndoManager()->AddEntry(UNDO_TYPE_NAMES, mpInfo);
2484
2485 //update callback func name
2486 mpInfo->callback_func = name;
2487
2488 mpProject->SetModified();
2489 }
2490 }
2491 }
2492 }
2493 }
2494
2495 ///////////////////////////////////////////////////////////////////////////////
SetChildAllocation(widget_info * info,int allocation_type)2496 void properties_win::SetChildAllocation(widget_info *info, int allocation_type)
2497 {
2498 while(info)
2499 {
2500 if (info->GetChildWidgetInfo())
2501 {
2502 SetChildAllocation(info->GetChildWidgetInfo(), allocation_type);
2503 }
2504 info->allocation = allocation_type;
2505 info = info->GetNextWidgetInfo();
2506 }
2507 }
2508
2509 ///////////////////////////////////////////////////////////////////////////////
OnChangeDynamicWidget()2510 void properties_win::OnChangeDynamicWidget()
2511 {
2512 CButton *pBox = (CButton *) GetDlgItem(ID_DYNAMIC_WIDGET);
2513 if (mpProject && mpInfo && pBox)
2514 {
2515 if (pBox->GetCheck())
2516 {
2517 if (mpInfo->is_template)
2518 {
2519 Notify("Templates cannot be dynamically allocated. Only widgets based on the template can be dynamically allocated");
2520 pBox->SetCheck(0);
2521 return;
2522 }
2523 UndoManager()->AddEntry(UNDO_TYPE_ALLOCATION, mpInfo);
2524 mpInfo->allocation = DYNAMIC_ALLOCATION_ROOT;
2525 SetChildAllocation(mpInfo->GetChildWidgetInfo(), DYNAMIC_ALLOCATION_CHILD);
2526 }
2527 else
2528 {
2529 UndoManager()->AddEntry(UNDO_TYPE_ALLOCATION, mpInfo);
2530 mpInfo->allocation = STATICALLY_ALLOCATED;
2531 SetChildAllocation(mpInfo->GetChildWidgetInfo(), STATICALLY_ALLOCATED);
2532 }
2533 mpProject->SetModified();
2534 }
2535 }
2536
2537 ///////////////////////////////////////////////////////////////////////////////
OnChangeDynamicBuffer()2538 void properties_win::OnChangeDynamicBuffer()
2539 {
2540 if (mpProject && mpInfo && GetDlgItem(ID_DYNAMIC_BUFFER))
2541 {
2542 UndoManager()->AddEntry(UNDO_TYPE_DYNAMIC_TEXT_BUFFER, mpInfo);
2543
2544 if (IsDlgButtonChecked(ID_DYNAMIC_BUFFER))
2545 {
2546 mpInfo->ewi.text_info.dynamic_buffer = true;
2547 }
2548 else
2549 {
2550 mpInfo->ewi.text_info.dynamic_buffer = false;
2551 }
2552 mpProject->SetModified();
2553 }
2554 }
2555
2556
2557 ///////////////////////////////////////////////////////////////////////////////
OnChangeWidgetPos()2558 void properties_win::OnChangeWidgetPos()
2559 {
2560 GX_RECTANGLE newsize;
2561
2562 if (mpProject && mpInfo && GetDlgItem(ID_XPOS))
2563 {
2564 if (mpInfo->widget == NULL)
2565 {
2566 return;
2567 }
2568
2569 if (mpInfo->widget->gx_widget_type == GX_TYPE_HORIZONTAL_SCROLL ||
2570 mpInfo->widget->gx_widget_type == GX_TYPE_VERTICAL_SCROLL)
2571 {
2572 OnScrollAppearanceChange();
2573 mpInfo->size = mpInfo->widget->gx_widget_size;
2574 return;
2575 }
2576
2577 int width, height;
2578
2579 if (mpInfo->basetype == GX_TYPE_TEMPLATE)
2580 {
2581 width = mpInfo->size.gx_rectangle_right - mpInfo->size.gx_rectangle_left + 1;
2582 height = mpInfo->size.gx_rectangle_bottom - mpInfo->size.gx_rectangle_top + 1;
2583 }
2584 else
2585 {
2586 width = GetDlgItemInt(ID_WIDTH, NULL, TRUE);
2587 height = GetDlgItemInt(ID_HEIGHT, NULL, TRUE);
2588 }
2589
2590 newsize.gx_rectangle_left = GetDlgItemInt(ID_XPOS, NULL, TRUE);
2591 newsize.gx_rectangle_top = GetDlgItemInt(ID_YPOS, NULL, TRUE);
2592 newsize.gx_rectangle_right = newsize.gx_rectangle_left + width - 1;
2593 newsize.gx_rectangle_bottom = newsize.gx_rectangle_top + height - 1;
2594
2595 int parent_type = GetTargetScreen()->GetWidgetParentType(mpInfo);
2596
2597 //Check of widget moving is allowed.
2598 if (!GetTargetScreen()->IsWidgetResizable(parent_type, mpInfo, newsize))
2599 {
2600 SetDlgItemInt(ID_XPOS, mpInfo->size.gx_rectangle_left);
2601 SetDlgItemInt(ID_YPOS, mpInfo->size.gx_rectangle_top);
2602 SetDlgItemInt(ID_WIDTH, mpInfo->size.gx_rectangle_right - mpInfo->size.gx_rectangle_left + 1);
2603 SetDlgItemInt(ID_HEIGHT, mpInfo->size.gx_rectangle_bottom - mpInfo->size.gx_rectangle_top + 1);
2604 return;
2605 }
2606
2607 if (newsize.gx_rectangle_left != mpInfo->size.gx_rectangle_left ||
2608 newsize.gx_rectangle_top != mpInfo->size.gx_rectangle_top ||
2609 newsize.gx_rectangle_right != mpInfo->size.gx_rectangle_right ||
2610 newsize.gx_rectangle_bottom != mpInfo->size.gx_rectangle_bottom)
2611 {
2612 UndoManager()->AddEntry(UNDO_TYPE_SIZE, mpInfo);
2613 widget_factory::MoveWidget(mpInfo, newsize);
2614
2615 GetTargetScreen()->WidgetWasMoved(mpInfo);
2616 mpProject->SetModified();
2617 }
2618 }
2619 }
2620
2621 ///////////////////////////////////////////////////////////////////////////////
OnChangeBorder()2622 void properties_win::OnChangeBorder()
2623 {
2624 CComboBox *pBox = (CComboBox *) GetDlgItem(ID_BORDER_COMBO);
2625
2626 if (mpProject && mpInfo && pBox)
2627 {
2628 int Selected = pBox->GetCurSel();
2629 ULONG style = (ULONG) pBox->GetItemData(Selected);
2630
2631 if (!(mpInfo->style & style))
2632 {
2633 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
2634
2635 gx_widget_border_style_set(mpInfo->widget, style);
2636
2637 mpInfo->style = mpInfo->widget->gx_widget_style;
2638
2639 GX_WIDGET *child = mpInfo->widget->gx_widget_first_child;
2640 GX_EVENT show_event;
2641
2642 while (child)
2643 {
2644 if ((child->gx_widget_type == GX_TYPE_VERTICAL_SCROLL) ||
2645 (child->gx_widget_type == GX_TYPE_HORIZONTAL_SCROLL))
2646 {
2647 memset(&show_event, 0, sizeof(GX_EVENT));
2648 show_event.gx_event_type = GX_EVENT_SHOW;
2649 child->gx_widget_event_process_function(child, &show_event);
2650 }
2651
2652 child = child->gx_widget_next;
2653 }
2654
2655 gx_system_dirty_mark(mpInfo->widget)
2656
2657 mpProject->SetModified();
2658 }
2659 }
2660 }
2661
2662 ///////////////////////////////////////////////////////////////////////////////
OnChangeTransparent()2663 void properties_win::OnChangeTransparent()
2664 {
2665 CButton *pb = (CButton *) GetDlgItem(ID_TRANSPARENT);
2666
2667 if (mpProject && mpInfo && mpInfo->widget && pb)
2668 {
2669 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
2670
2671 if (pb->GetCheck() == BST_CHECKED)
2672 {
2673 mpInfo->style |= GX_STYLE_TRANSPARENT;
2674 }
2675 else
2676 {
2677 mpInfo->style &= ~GX_STYLE_TRANSPARENT;
2678 }
2679 gx_widget_style_set(mpInfo->widget, mpInfo->style);
2680
2681 if ((mpInfo->basetype == GX_TYPE_VERTICAL_SCROLL) ||
2682 (mpInfo->basetype == GX_TYPE_HORIZONTAL_SCROLL))
2683 {
2684 // Send show event to update parent client area
2685 GX_EVENT show_event;
2686
2687 memset(&show_event, 0, sizeof(GX_EVENT));
2688 show_event.gx_event_type = GX_EVENT_SHOW;
2689 show_event.gx_event_target = mpInfo->widget;
2690 gx_system_event_send(&show_event);
2691 }
2692
2693 mpProject->SetModified();
2694 }
2695 }
2696
2697 ///////////////////////////////////////////////////////////////////////////////
OnChangeSelected()2698 void properties_win::OnChangeSelected()
2699 {
2700 CButton *pb = (CButton *) GetDlgItem(ID_SELECTED);
2701
2702 if (mpProject && mpInfo && pb)
2703 {
2704 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
2705
2706 if (pb->GetCheck() == BST_CHECKED)
2707 {
2708 mpInfo->style |= GX_STYLE_DRAW_SELECTED;
2709 }
2710 else
2711 {
2712 mpInfo->style &= ~GX_STYLE_DRAW_SELECTED;
2713 }
2714 gx_widget_style_set(mpInfo->widget, mpInfo->style);
2715 mpProject->SetModified();
2716 }
2717 }
2718
2719 ///////////////////////////////////////////////////////////////////////////////
OnChangeEnabled()2720 void properties_win::OnChangeEnabled()
2721 {
2722 if (mpProject && mpInfo && GetDlgItem(ID_ENABLED))
2723 {
2724 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
2725
2726 if (IsDlgButtonChecked(ID_ENABLED))
2727 {
2728 mpInfo->style |= GX_STYLE_ENABLED;
2729 }
2730 else
2731 {
2732 mpInfo->style &= ~GX_STYLE_ENABLED;
2733 }
2734 gx_widget_style_set(mpInfo->widget, mpInfo->style);
2735 mpProject->SetModified();
2736 }
2737 }
2738
2739 ///////////////////////////////////////////////////////////////////////////////
OnChangeTextCopy()2740 void properties_win::OnChangeTextCopy()
2741 {
2742 if (mpProject && mpInfo && GetDlgItem(ID_TEXT_COPY))
2743 {
2744 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
2745
2746 if (IsDlgButtonChecked(ID_TEXT_COPY))
2747 {
2748 mpInfo->style |= GX_STYLE_TEXT_COPY;
2749 }
2750 else
2751 {
2752 mpInfo->style &= ~GX_STYLE_TEXT_COPY;
2753 }
2754 gx_widget_style_set(mpInfo->widget, mpInfo->style);
2755 mpProject->SetModified();
2756 }
2757 }
2758
2759 ///////////////////////////////////////////////////////////////////////////////
OnChangeMLTextVCenter()2760 void properties_win::OnChangeMLTextVCenter()
2761 {
2762 if (mpProject && mpInfo && GetDlgItem(ID_ML_TEXT_VCENTER))
2763 {
2764 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
2765
2766 if (IsDlgButtonChecked(ID_ML_TEXT_VCENTER))
2767 {
2768 GX_SCROLLBAR *scroll;
2769 gx_window_scrollbar_find((GX_WINDOW *) mpInfo->widget, GX_TYPE_VERTICAL_SCROLL, &scroll);
2770 if (scroll)
2771 {
2772 Notify("This style has no effect if the text view has a vertical scrollbar.", this);
2773 }
2774 mpInfo->style |= GX_STYLE_VALIGN_CENTER;
2775 }
2776 else
2777 {
2778 mpInfo->style &= ~GX_STYLE_VALIGN_CENTER;
2779 GX_MULTI_LINE_TEXT_VIEW *mltv = (GX_MULTI_LINE_TEXT_VIEW *) mpInfo->widget;
2780 mltv->gx_multi_line_text_view_text_scroll_shift = 0;
2781 }
2782 gx_widget_style_set(mpInfo->widget, mpInfo->style);
2783 mpProject->SetModified();
2784 }
2785 }
2786
2787
2788 ///////////////////////////////////////////////////////////////////////////////
OnChangeFocus()2789 void properties_win::OnChangeFocus()
2790 {
2791 if (mpProject && mpInfo && GetDlgItem(ID_ACCEPTS_FOCUS))
2792 {
2793 UndoManager()->AddEntry(UNDO_TYPE_FOCUS, mpInfo);
2794
2795 if (IsDlgButtonChecked(ID_ACCEPTS_FOCUS))
2796 {
2797 mpInfo->accepts_focus = TRUE;
2798 }
2799 else
2800 {
2801 mpInfo->accepts_focus = FALSE;
2802 }
2803 mpProject->SetModified();
2804 }
2805 }
2806
2807 ///////////////////////////////////////////////////////////////////////////////
OnChangeReadonly()2808 void properties_win::OnChangeReadonly()
2809 {
2810 if (mpProject && mpInfo && GetDlgItem(ID_TEXT_INPUT_READONLY))
2811 {
2812 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
2813
2814 if (IsDlgButtonChecked(ID_TEXT_INPUT_READONLY))
2815 {
2816 mpInfo->style |= GX_STYLE_TEXT_INPUT_READONLY;
2817 }
2818 else
2819 {
2820 mpInfo->style &= ~GX_STYLE_TEXT_INPUT_READONLY;
2821 }
2822 gx_widget_style_set(mpInfo->widget, mpInfo->style);
2823 mpProject->SetModified();
2824 }
2825 }
2826
2827 ///////////////////////////////////////////////////////////////////////////////
OnChangeColor()2828 void properties_win::OnChangeColor()
2829 {
2830 CComboBox *pNormBox = (CComboBox *)GetDlgItem(ID_NORMAL_COLOR);
2831 CComboBox *pSelBox = (CComboBox *)GetDlgItem(ID_SELECTED_COLOR);
2832 CComboBox *pDisabledBox = (CComboBox *)GetDlgItem(ID_DISABLED_COLOR);
2833 GX_BOOL Is_Modified = GX_FALSE;
2834
2835 if (mpProject && mpInfo && pNormBox)
2836 {
2837 int index, color_id;
2838
2839 color_id = pNormBox->GetItemData(pNormBox->GetCurSel());
2840 if (color_id != mpInfo->color_id[NORMAL_FILL_COLOR_INDEX])
2841 {
2842 //normal fill color changed
2843 UndoManager()->AddEntry(UNDO_TYPE_COLOR, mpInfo, NORMAL_FILL_COLOR_INDEX);
2844 index = NORMAL_FILL_COLOR_INDEX;
2845 Is_Modified = GX_TRUE;
2846 }
2847
2848 if (!Is_Modified)
2849 {
2850 color_id = pSelBox->GetItemData(pSelBox->GetCurSel());
2851
2852 if (color_id != mpInfo->color_id[SELECTED_FILL_COLOR_INDEX])
2853 {
2854 //selected fill color changed
2855 UndoManager()->AddEntry(UNDO_TYPE_COLOR, mpInfo, SELECTED_FILL_COLOR_INDEX);
2856 index = SELECTED_FILL_COLOR_INDEX;
2857 Is_Modified = GX_TRUE;
2858 }
2859 }
2860
2861 if (!Is_Modified)
2862 {
2863 color_id = pDisabledBox->GetItemData(pDisabledBox->GetCurSel());
2864 if (color_id != mpInfo->color_id[DISABLED_FILL_COLOR_INDEX])
2865 {
2866 //disabled fill color changed
2867 UndoManager()->AddEntry(UNDO_TYPE_COLOR, mpInfo, DISABLED_FILL_COLOR_INDEX);
2868 index = DISABLED_FILL_COLOR_INDEX;
2869 Is_Modified = GX_TRUE;
2870 }
2871 }
2872
2873 if (Is_Modified)
2874 {
2875 widget_service_provider *provider = widget_factory::GetServiceProvider(mpInfo->basetype);
2876 if (provider)
2877 {
2878 //assign new colors
2879 provider->AssignColor(mpInfo, index, color_id);
2880 }
2881
2882 mpProject->SetModified();
2883 }
2884 }
2885 }
2886
2887 ///////////////////////////////////////////////////////////////////////////////
OnChangeTileWallpaper()2888 void properties_win::OnChangeTileWallpaper()
2889 {
2890 CButton *pb = (CButton *) GetDlgItem(ID_TILE_WALLPAPER);
2891
2892 if (mpProject && mpInfo && pb)
2893 {
2894 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
2895
2896 if (pb->GetCheck() == BST_CHECKED)
2897 {
2898 mpInfo->style |= GX_STYLE_TILE_WALLPAPER;
2899 }
2900 else
2901 {
2902 mpInfo->style &= ~GX_STYLE_TILE_WALLPAPER;
2903 }
2904 gx_widget_style_set(mpInfo->widget, mpInfo->style);
2905 mpProject->SetModified();
2906 }
2907 }
2908
2909 ///////////////////////////////////////////////////////////////////////////////
OnChangeNumericPrompt()2910 void properties_win::OnChangeNumericPrompt()
2911 {
2912 CComboBox *pBox = (CComboBox *)GetDlgItem(ID_STRING_ID);
2913 CEdit *pEdit = (CEdit *)GetDlgItem(ID_NUMERIC_PROMPT_VALUE);
2914 BOOL Is_Modified = GX_FALSE;
2915
2916 if (mpProject && mpInfo && pBox && pEdit)
2917 {
2918 int numeric_value = GetDlgItemInt(ID_NUMERIC_PROMPT_VALUE, 0, TRUE);
2919 CString format_func;
2920
2921 GetDlgItemText(ID_FORMAT_FUNC, format_func);
2922
2923 if (numeric_value != mpInfo->ewi.numeric_prompt_value)
2924 {
2925 Is_Modified = TRUE;
2926 }
2927
2928 if (format_func != mpInfo->format_func)
2929 {
2930 if (format_func.IsEmpty())
2931 {
2932 Is_Modified = TRUE;
2933 }
2934
2935 if (!format_func.IsEmpty())
2936 {
2937 pEdit = (CEdit *)GetDlgItem(ID_FORMAT_FUNC);
2938 if (TestInputName(pEdit, "Format Func", format_func))
2939 {
2940 Is_Modified = TRUE;
2941 }
2942 else
2943 {
2944 pEdit->SetWindowText(mpInfo->format_func);
2945 }
2946 }
2947 }
2948
2949 if (Is_Modified)
2950 {
2951 UndoManager()->AddEntry(UNDO_TYPE_NUMERIC_PROMPT_INFO, mpInfo);
2952
2953 prompt_service_provider *provider = (prompt_service_provider *)(widget_factory::GetServiceProvider(mpInfo->basetype));
2954
2955 /* Assign numeric value. */
2956 provider->AssignNumericValue(mpInfo, numeric_value);
2957
2958 /* Clear string id setting. */
2959 pBox->SetCurSel(0);
2960
2961 mpInfo->format_func = format_func;
2962
2963 mpProject->SetModified();
2964 }
2965 }
2966 }
2967
2968 ///////////////////////////////////////////////////////////////////////////////
OnPixelmapChange(int index)2969 void properties_win::OnPixelmapChange(int index)
2970 {
2971 CComboBox *pImageBox = (CComboBox *) GetDlgItem(ID_PIXELMAP_0 + index);
2972
2973 if (mpProject && mpInfo && pImageBox)
2974 {
2975 int box_index = pImageBox->GetCurSel();
2976 int image_id = pImageBox->GetItemData(box_index);
2977
2978 widget_service_provider *provider = widget_factory::GetServiceProvider(mpInfo->basetype);
2979
2980 if ((mpInfo->pixelmap_id[index] != image_id) && provider)
2981 {
2982 UndoManager()->AddEntry(UNDO_TYPE_PIXELMAP, mpInfo, index);
2983 provider->AssignPixelmap(mpInfo, index, image_id);
2984 mpProject->SetModified();
2985 }
2986 }
2987 }
2988
2989 ///////////////////////////////////////////////////////////////////////////////
OnChangePixelmap0()2990 void properties_win::OnChangePixelmap0()
2991 {
2992 OnPixelmapChange(0);
2993 }
2994 ///////////////////////////////////////////////////////////////////////////////
OnChangePixelmap1()2995 void properties_win::OnChangePixelmap1()
2996 {
2997 OnPixelmapChange(1);
2998 }
2999 ///////////////////////////////////////////////////////////////////////////////
OnChangePixelmap2()3000 void properties_win::OnChangePixelmap2()
3001 {
3002 OnPixelmapChange(2);
3003 }
3004 ///////////////////////////////////////////////////////////////////////////////
OnChangePixelmap3()3005 void properties_win::OnChangePixelmap3()
3006 {
3007 OnPixelmapChange(3);
3008 }
3009 ///////////////////////////////////////////////////////////////////////////////
OnChangePixelmap4()3010 void properties_win::OnChangePixelmap4()
3011 {
3012 OnPixelmapChange(4);
3013 }
3014 ///////////////////////////////////////////////////////////////////////////////
OnChangePixelmap5()3015 void properties_win::OnChangePixelmap5()
3016 {
3017 OnPixelmapChange(5);
3018 }
3019 ///////////////////////////////////////////////////////////////////////////////
OnChangePixelmap6()3020 void properties_win::OnChangePixelmap6()
3021 {
3022 OnPixelmapChange(6);
3023 }
3024 ///////////////////////////////////////////////////////////////////////////////
OnChangePixelmap7()3025 void properties_win::OnChangePixelmap7()
3026 {
3027 OnPixelmapChange(7);
3028 }
3029
3030 ///////////////////////////////////////////////////////////////////////////////
OnFontChange(int index)3031 void properties_win::OnFontChange(int index)
3032 {
3033 CComboBox *pFontBox = (CComboBox *) GetDlgItem(ID_FONT_SELECT_0 + index);
3034
3035 if (mpProject && mpInfo && pFontBox)
3036 {
3037 int box_index = pFontBox->GetCurSel();
3038 int FontId = pFontBox->GetItemData(box_index);
3039
3040 if (FontId != mpInfo->font_id[index])
3041 {
3042 widget_service_provider *provider = widget_factory::GetServiceProvider(mpInfo->basetype);
3043
3044 if (provider)
3045 {
3046 UndoManager()->AddEntry(UNDO_TYPE_FONT, mpInfo, index);
3047
3048 provider->AssignFont(mpInfo, index, FontId);
3049 mpProject->SetModified();
3050 }
3051 }
3052 }
3053 }
3054
3055 ///////////////////////////////////////////////////////////////////////////////
OnFontChange0()3056 void properties_win::OnFontChange0()
3057 {
3058 OnFontChange(0);
3059 }
3060
3061 ///////////////////////////////////////////////////////////////////////////////
OnFontChange1()3062 void properties_win::OnFontChange1()
3063 {
3064 OnFontChange(1);
3065 }
3066
3067 ///////////////////////////////////////////////////////////////////////////////
OnFontChange2()3068 void properties_win::OnFontChange2()
3069 {
3070 OnFontChange(2);
3071 }
3072
3073 ///////////////////////////////////////////////////////////////////////////////
OnFontChange3()3074 void properties_win::OnFontChange3()
3075 {
3076 OnFontChange(3);
3077 }
3078
3079 ///////////////////////////////////////////////////////////////////////////////
OnChangeNormalTextColor()3080 void properties_win::OnChangeNormalTextColor()
3081 {
3082 CComboBox *pColorBox = (CComboBox *) GetDlgItem(ID_NORMAL_TEXT_COLOR);
3083
3084 if (mpProject && mpInfo && pColorBox)
3085 {
3086 int box_index = pColorBox->GetCurSel();
3087 int ColorId = pColorBox->GetItemData(box_index);
3088 widget_service_provider *provider = widget_factory::GetServiceProvider(mpInfo->basetype);
3089
3090 if ((ColorId != mpInfo->color_id[NORMAL_TEXT_COLOR_INDEX]) && provider)
3091 {
3092 UndoManager()->AddEntry(UNDO_TYPE_COLOR, mpInfo, NORMAL_TEXT_COLOR_INDEX);
3093
3094 provider->AssignColor(mpInfo, NORMAL_TEXT_COLOR_INDEX, ColorId);
3095 mpProject->SetModified();
3096 }
3097 }
3098 }
3099
3100 ///////////////////////////////////////////////////////////////////////////////
OnChangeSelectedTextColor()3101 void properties_win::OnChangeSelectedTextColor()
3102 {
3103 CComboBox *pColorBox = (CComboBox *) GetDlgItem(ID_SELECTED_TEXT_COLOR);
3104
3105 if (mpProject && mpInfo && pColorBox)
3106 {
3107 int box_index = pColorBox->GetCurSel();
3108 int ColorId = pColorBox->GetItemData(box_index);
3109
3110 widget_service_provider *provider = widget_factory::GetServiceProvider(mpInfo->basetype);
3111
3112 if ((ColorId != mpInfo->color_id[SELECTED_TEXT_COLOR_INDEX]) && provider)
3113 {
3114 UndoManager()->AddEntry(UNDO_TYPE_COLOR, mpInfo, SELECTED_TEXT_COLOR_INDEX);
3115 provider->AssignColor(mpInfo, SELECTED_TEXT_COLOR_INDEX, ColorId);
3116 mpProject->SetModified();
3117 }
3118 }
3119 }
3120
3121 ///////////////////////////////////////////////////////////////////////////////
OnChangeDisabledTextColor()3122 void properties_win::OnChangeDisabledTextColor()
3123 {
3124 CComboBox *pColorBox = (CComboBox *)GetDlgItem(ID_DISABLED_TEXT_COLOR);
3125
3126 if (mpProject && mpInfo && pColorBox)
3127 {
3128 int box_index = pColorBox->GetCurSel();
3129 int ColorId = pColorBox->GetItemData(box_index);
3130
3131 widget_service_provider *provider = widget_factory::GetServiceProvider(mpInfo->basetype);
3132
3133 if ((ColorId != mpInfo->color_id[DISABLED_TEXT_COLOR_INDEX]) && provider)
3134 {
3135 UndoManager()->AddEntry(UNDO_TYPE_COLOR, mpInfo, DISABLED_TEXT_COLOR_INDEX);
3136 provider->AssignColor(mpInfo, DISABLED_TEXT_COLOR_INDEX, ColorId);
3137 mpProject->SetModified();
3138 }
3139 }
3140 }
3141
3142 ///////////////////////////////////////////////////////////////////////////////
OnChangeReadonlyFillColor()3143 void properties_win::OnChangeReadonlyFillColor()
3144 {
3145 CComboBox *pColorBox = (CComboBox *)GetDlgItem(ID_READONLY_COLOR);
3146
3147 if (mpProject && mpInfo && pColorBox)
3148 {
3149 int box_index = pColorBox->GetCurSel();
3150 int ColorId = pColorBox->GetItemData(box_index);
3151
3152 widget_service_provider *provider = widget_factory::GetServiceProvider(mpInfo->basetype);
3153
3154 if ((ColorId != mpInfo->color_id[READONLY_FILL_COLOR_INDEX]) && provider)
3155 {
3156 UndoManager()->AddEntry(UNDO_TYPE_COLOR, mpInfo, READONLY_FILL_COLOR_INDEX);
3157 provider->AssignColor(mpInfo, READONLY_FILL_COLOR_INDEX, ColorId);
3158 mpProject->SetModified();
3159 }
3160 }
3161 }
3162
3163 ///////////////////////////////////////////////////////////////////////////////
OnChangeReadonlyTextColor()3164 void properties_win::OnChangeReadonlyTextColor()
3165 {
3166 CComboBox *pColorBox = (CComboBox *)GetDlgItem(ID_READONLY_TEXT_COLOR);
3167
3168 if (mpProject && mpInfo && pColorBox)
3169 {
3170 int box_index = pColorBox->GetCurSel();
3171 int ColorId = pColorBox->GetItemData(box_index);
3172
3173 widget_service_provider *provider = widget_factory::GetServiceProvider(mpInfo->basetype);
3174
3175 if ((ColorId != mpInfo->color_id[READONLY_TEXT_COLOR_INDEX]) && provider)
3176 {
3177 UndoManager()->AddEntry(UNDO_TYPE_COLOR, mpInfo, READONLY_TEXT_COLOR_INDEX);
3178 provider->AssignColor(mpInfo, READONLY_TEXT_COLOR_INDEX, ColorId);
3179 mpProject->SetModified();
3180 }
3181 }
3182 }
3183
3184 ///////////////////////////////////////////////////////////////////////////////
OnTextAlignmentChange()3185 void properties_win::OnTextAlignmentChange()
3186 {
3187 CComboBox *pAlign = (CComboBox *) GetDlgItem(ID_TEXT_ALIGN);
3188 ULONG style = 0;
3189
3190 if (mpProject && mpInfo && pAlign)
3191 {
3192 int selected = pAlign->GetCurSel();
3193
3194 if (selected >= 0)
3195 {
3196 style = (ULONG) pAlign->GetItemData(selected);
3197 }
3198
3199 if ((mpInfo->style & GX_STYLE_TEXT_ALIGNMENT_MASK) != style)
3200 {
3201 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
3202
3203 mpInfo->style &= ~(GX_STYLE_TEXT_ALIGNMENT_MASK);
3204 mpInfo->style |= style;
3205
3206 gx_widget_style_set(mpInfo->widget, mpInfo->style);
3207
3208 mpProject->SetModified();
3209 }
3210 }
3211 }
3212
3213 ///////////////////////////////////////////////////////////////////////////////
OnChangePixmapAlign()3214 void properties_win::OnChangePixmapAlign()
3215 {
3216 CComboBox *pHAlign = (CComboBox *) GetDlgItem(ID_PIXMAP_HALIGN);
3217 CComboBox *pVAlign = (CComboBox *) GetDlgItem(ID_PIXMAP_VALIGN);
3218
3219 if (mpProject && mpInfo && pHAlign && pVAlign)
3220 {
3221 int selected = pHAlign->GetCurSel();
3222 ULONG hStyle = 0;
3223 ULONG vStyle = 0;
3224
3225 if (selected >= 0)
3226 {
3227 hStyle = (ULONG) pHAlign->GetItemData(selected);
3228 hStyle &= GX_PIXELMAP_HALIGN_MASK;
3229 }
3230
3231 selected = pVAlign->GetCurSel();
3232
3233 if (selected >= 0)
3234 {
3235 vStyle = (ULONG) pVAlign->GetItemData(selected);
3236 vStyle &= GX_PIXELMAP_VALIGN_MASK;
3237 }
3238
3239 if ((mpInfo->style & (GX_PIXELMAP_HALIGN_MASK | GX_PIXELMAP_VALIGN_MASK)) != (hStyle | vStyle))
3240 {
3241 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
3242
3243 mpInfo->style &= ~(GX_PIXELMAP_HALIGN_MASK | GX_PIXELMAP_VALIGN_MASK);
3244 mpInfo->style |= hStyle | vStyle;
3245 gx_widget_style_set(mpInfo->widget, mpInfo->style);
3246 mpProject->SetModified();
3247 }
3248 }
3249 }
3250
3251 ///////////////////////////////////////////////////////////////////////////////
OnButtonStyleChange()3252 void properties_win::OnButtonStyleChange()
3253 {
3254 if (mpProject && mpInfo && GetDlgItem(ID_BUTTON_STYLE_PUSHED))
3255 {
3256 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
3257
3258 ULONG style = mpInfo->style;
3259
3260 if (IsDlgButtonChecked(ID_BUTTON_STYLE_PUSHED))
3261 {
3262 style |= GX_STYLE_BUTTON_PUSHED;
3263 }
3264 else
3265 {
3266 style &= ~GX_STYLE_BUTTON_PUSHED;
3267 }
3268
3269 if (IsDlgButtonChecked(ID_BUTTON_STYLE_TOGGLE))
3270 {
3271 style |= GX_STYLE_BUTTON_TOGGLE;
3272 }
3273 else
3274 {
3275 style &= ~GX_STYLE_BUTTON_TOGGLE;
3276 }
3277
3278 if (IsDlgButtonChecked(ID_BUTTON_STYLE_RADIO))
3279 {
3280 style |= GX_STYLE_BUTTON_RADIO;
3281 }
3282 else
3283 {
3284 style &= ~GX_STYLE_BUTTON_RADIO;
3285 }
3286 if (IsDlgButtonChecked(ID_BUTTON_STYLE_REPEAT))
3287 {
3288 style |= GX_STYLE_BUTTON_REPEAT;
3289 }
3290 else
3291 {
3292 style &= ~GX_STYLE_BUTTON_REPEAT;
3293 }
3294
3295 mpInfo->style = style;
3296 gx_widget_style_set(mpInfo->widget, style);
3297 mpProject->SetModified();
3298 }
3299 }
3300
3301 ///////////////////////////////////////////////////////////////////////////////
OnDropListStyleChange()3302 void properties_win::OnDropListStyleChange()
3303 {
3304 if (mpProject && mpInfo && GetDlgItem(ID_TILE_DROP_LIST_BACKGROUND))
3305 {
3306 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
3307 ULONG style = mpInfo->style;
3308
3309 if (IsDlgButtonChecked(ID_TILE_DROP_LIST_BACKGROUND))
3310 {
3311 style |= GX_STYLE_TILE_BACKGROUND;
3312 gx_widget_style_add(mpInfo->widget, GX_STYLE_TILE_BACKGROUND);
3313 }
3314 else
3315 {
3316 style &= ~GX_STYLE_TILE_BACKGROUND;
3317 gx_widget_style_remove(mpInfo->widget, GX_STYLE_TILE_BACKGROUND);
3318 }
3319
3320 if (IsDlgButtonChecked(ID_TILE_DROP_LIST_POPLIST_WALLPAPER))
3321 {
3322 style |= GX_STYLE_TILE_WALLPAPER;
3323 gx_widget_style_add((GX_WIDGET *)&(((GX_DROP_LIST *)mpInfo->widget)->gx_drop_list_popup.gx_popup_list_list), GX_STYLE_TILE_WALLPAPER);
3324
3325 }
3326 else
3327 {
3328 style &= ~GX_STYLE_TILE_WALLPAPER;
3329 gx_widget_style_remove((GX_WIDGET *)&(((GX_DROP_LIST *)mpInfo->widget)->gx_drop_list_popup.gx_popup_list_list), GX_STYLE_TILE_WALLPAPER);
3330 }
3331
3332 mpInfo->style = style;
3333 mpProject->SetModified();
3334 }
3335 }
3336 ///////////////////////////////////////////////////////////////////////////////
OnSliderStyleChange()3337 void properties_win::OnSliderStyleChange()
3338 {
3339 if (mpProject && mpInfo && GetDlgItem(ID_SLIDER_VERTICAL))
3340 {
3341 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
3342
3343 ULONG style = mpInfo->style;
3344
3345 if (IsDlgButtonChecked(ID_SLIDER_VERTICAL))
3346 {
3347 style |= GX_STYLE_SLIDER_VERTICAL;
3348 }
3349 else
3350 {
3351 style &= ~GX_STYLE_SLIDER_VERTICAL;
3352 }
3353 if (IsDlgButtonChecked(ID_SLIDER_TILE_BKGND))
3354 {
3355 style |= GX_STYLE_TILE_BACKGROUND;
3356 }
3357 else
3358 {
3359 style &= ~GX_STYLE_TILE_BACKGROUND;
3360 }
3361
3362 if (mpInfo->basetype == GX_TYPE_SLIDER)
3363 {
3364 if (IsDlgButtonChecked(ID_SHOW_TICKMARKS))
3365 {
3366 style |= GX_STYLE_SHOW_TICKMARKS;
3367 }
3368 else
3369 {
3370 style &= ~GX_STYLE_SHOW_TICKMARKS;
3371 }
3372 }
3373 mpInfo->style = style;
3374 gx_widget_style_set(mpInfo->widget, style);
3375 mpProject->SetModified();
3376 }
3377 }
3378
3379 ///////////////////////////////////////////////////////////////////////////////
OnChangeSliderInfo()3380 void properties_win::OnChangeSliderInfo()
3381 {
3382 if (mpProject && mpInfo && GetDlgItem(ID_SLIDER_MINVAL))
3383 {
3384 GX_SLIDER *slider = (GX_SLIDER *) mpInfo->widget;
3385
3386 GX_SLIDER_INFO info = mpInfo->ewi.slider;
3387 info.gx_slider_info_min_val = GetDlgItemInt(ID_SLIDER_MINVAL, NULL, TRUE);
3388 info.gx_slider_info_max_val = GetDlgItemInt(ID_SLIDER_MAXVAL, NULL, TRUE);
3389 info.gx_slider_info_current_val = GetDlgItemInt(ID_SLIDER_CURRENTVAL, NULL, TRUE);
3390 info.gx_slider_info_increment = GetDlgItemInt(ID_SLIDER_INCREMENT, NULL, TRUE);
3391 info.gx_slider_info_min_travel = GetDlgItemInt(ID_SLIDER_MINTRAVEL, NULL, TRUE);
3392 info.gx_slider_info_max_travel = GetDlgItemInt(ID_SLIDER_MAXTRAVEL, NULL, TRUE);
3393 info.gx_slider_info_needle_width = GetDlgItemInt(ID_SLIDER_NEEDLE_WIDTH, NULL, TRUE);
3394 info.gx_slider_info_needle_height = GetDlgItemInt(ID_SLIDER_NEEDLE_HEIGHT, NULL, TRUE);
3395 info.gx_slider_info_needle_inset = GetDlgItemInt(ID_SLIDER_NEEDLE_INSET, NULL, TRUE);
3396 info.gx_slider_info_needle_hotspot_offset = GetDlgItemInt(ID_NEEDLE_HOTSPOT, NULL, TRUE);
3397
3398 INT tick_count = mpInfo->misc_value;
3399
3400 if (mpInfo->basetype == GX_TYPE_SLIDER)
3401 {
3402 tick_count = GetDlgItemInt(ID_TICKMARK_COUNT);
3403 }
3404
3405 if (memcmp(&info, &mpInfo->ewi.slider, sizeof(GX_SLIDER_INFO)) ||
3406 (tick_count != mpInfo->misc_value))
3407 {
3408 UndoManager()->AddEntry(UNDO_TYPE_SLIDER_INFO, mpInfo);
3409
3410 mpInfo->ewi.slider = info;
3411 gx_slider_info_set(slider, &mpInfo->ewi.slider);
3412 mpInfo->misc_value = tick_count;
3413 slider->gx_slider_tick_count = tick_count;
3414
3415 mpProject->SetModified();
3416 }
3417 }
3418 }
3419
3420 ///////////////////////////////////////////////////////////////////////////////
AssignProgressBarInfo(widget_info * wi)3421 void properties_win::AssignProgressBarInfo(widget_info *wi)
3422 {
3423 GX_PROGRESS_BAR_INFO info;
3424 info.gx_progress_bar_font_id = wi->font_id[0];
3425 info.gx_progress_bar_fill_pixelmap = wi->pixelmap_id[NORMAL_PIXELMAP_INDEX];
3426 info.gx_progress_bar_info_current_val = wi->ewi.progress.current_val;
3427 info.gx_progress_bar_info_min_val = wi->ewi.progress.min_val;
3428 info.gx_progress_bar_info_max_val = wi->ewi.progress.max_val;
3429 info.gx_progress_bar_normal_text_color = wi->color_id[NORMAL_TEXT_COLOR_INDEX];
3430 info.gx_progress_bar_selected_text_color = wi->color_id[SELECTED_TEXT_COLOR_INDEX];
3431 info.gx_progress_bar_disabled_text_color = wi->color_id[DISABLED_TEXT_COLOR_INDEX];
3432
3433 GX_PROGRESS_BAR *bar = (GX_PROGRESS_BAR *) wi->widget;
3434 gx_progress_bar_info_set(bar, &info);
3435 }
3436
3437 ///////////////////////////////////////////////////////////////////////////////
SendEditFocusLoseMessage()3438 void properties_win::SendEditFocusLoseMessage()
3439 {
3440 CWnd *focus_owner = GetFocus();
3441 TCHAR class_name[MAX_PATH];
3442
3443 GetClassName(focus_owner->GetSafeHwnd(), class_name, MAX_PATH - 1);
3444
3445 CString rich_edit_str(_T("RichEdit"));
3446 CString edit_str(_T("Edit"));
3447
3448 if (_tcsncmp(class_name, rich_edit_str, rich_edit_str.GetLength()) == 0 ||
3449 _tcsncmp(class_name, edit_str, edit_str.GetLength()) == 0)
3450 {
3451 SendMessage(WM_COMMAND, MAKEWPARAM(focus_owner->GetDlgCtrlID(), EN_KILLFOCUS), (LPARAM)(focus_owner->m_hWnd));
3452 }
3453 }
3454
3455 ///////////////////////////////////////////////////////////////////////////////
OnProgressInfoChange()3456 void properties_win::OnProgressInfoChange()
3457 {
3458 if (mpProject && mpInfo && GetDlgItem(ID_PROGRESS_VERTICAL))
3459 {
3460 ULONG style = mpInfo->style;
3461 GX_BOOL Is_Modified = FALSE;
3462
3463 if (IsDlgButtonChecked(ID_PROGRESS_VERTICAL))
3464 {
3465 style |= GX_STYLE_PROGRESS_VERTICAL;
3466 }
3467 else
3468 {
3469 style &= ~GX_STYLE_PROGRESS_VERTICAL;
3470 }
3471
3472 if (IsDlgButtonChecked(ID_PROGRESS_SHOW_TEXT))
3473 {
3474 style |= GX_STYLE_PROGRESS_TEXT_DRAW;
3475 }
3476 else
3477 {
3478 style &= ~GX_STYLE_PROGRESS_TEXT_DRAW;
3479 }
3480
3481 if (IsDlgButtonChecked(ID_PROGRESS_PERCENT))
3482 {
3483 style |= GX_STYLE_PROGRESS_PERCENT;
3484 }
3485 else
3486 {
3487 style &= ~GX_STYLE_PROGRESS_PERCENT;
3488 }
3489
3490 if (style != mpInfo->style)
3491 {
3492 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
3493 mpInfo->style = style;
3494 gx_widget_style_set(mpInfo->widget, style);
3495 Is_Modified = TRUE;
3496 }
3497
3498 int min, max, current;
3499
3500 min = GetDlgItemInt(ID_PROGRESS_MINVAL);
3501 max = GetDlgItemInt(ID_PROGRESS_MAXVAL);
3502 current = GetDlgItemInt(ID_PROGRESS_CURRENTVAL);
3503
3504 if (min != mpInfo->ewi.progress.min_val ||
3505 max != mpInfo->ewi.progress.max_val ||
3506 current != mpInfo->ewi.progress.current_val)
3507 {
3508 UndoManager()->AddEntry(UNDO_TYPE_PROGRESS_BAR_INFO, mpInfo);
3509
3510 mpInfo->ewi.progress.min_val = min;
3511 mpInfo->ewi.progress.max_val = max;
3512 mpInfo->ewi.progress.current_val = current;
3513
3514 AssignProgressBarInfo(mpInfo);
3515 Is_Modified = TRUE;
3516 }
3517
3518 if (Is_Modified)
3519 {
3520 mpProject->SetModified();
3521 }
3522 }
3523 }
3524
3525 ///////////////////////////////////////////////////////////////////////////////
OnChangeRadialProgressBarInfo()3526 void properties_win::OnChangeRadialProgressBarInfo()
3527 {
3528 if (mpProject && mpInfo && GetDlgItem(ID_RADIAL_PROGRESS_SHOW_TEXT))
3529 {
3530 ULONG style = mpInfo->style;
3531 BOOL Is_Modified = FALSE;
3532
3533 if (IsDlgButtonChecked(ID_RADIAL_PROGRESS_SHOW_TEXT))
3534 {
3535 style |= GX_STYLE_PROGRESS_TEXT_DRAW;
3536 }
3537 else
3538 {
3539 style &= ~GX_STYLE_PROGRESS_TEXT_DRAW;
3540 }
3541
3542 if (IsDlgButtonChecked(ID_RADIAL_PROGRESS_PERCENT))
3543 {
3544 style |= GX_STYLE_PROGRESS_PERCENT;
3545 }
3546 else
3547 {
3548 style &= ~GX_STYLE_PROGRESS_PERCENT;
3549 }
3550
3551 if (IsDlgButtonChecked(ID_RADIAL_PROGRESS_BACKTRACK))
3552 {
3553 style &= ~GX_STYLE_RADIAL_PROGRESS_NO_BACKTRACK;
3554 }
3555 else
3556 {
3557 style |= GX_STYLE_RADIAL_PROGRESS_NO_BACKTRACK;
3558 }
3559
3560 if (IsDlgButtonChecked(ID_RADIAL_PROGRESS_ALIAS))
3561 {
3562 style |= GX_STYLE_RADIAL_PROGRESS_ALIAS;
3563 }
3564 else
3565 {
3566 style &= ~GX_STYLE_RADIAL_PROGRESS_ALIAS;
3567 }
3568
3569 if (IsDlgButtonChecked(ID_RADIAL_PROGRESS_ROUND))
3570 {
3571 style |= GX_STYLE_RADIAL_PROGRESS_ROUND;
3572 }
3573 else
3574 {
3575 style &= ~GX_STYLE_RADIAL_PROGRESS_ROUND;
3576 }
3577
3578 if (style != mpInfo->style)
3579 {
3580 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
3581 mpInfo->style = style;
3582 gx_widget_style_set(mpInfo->widget, style);
3583 Is_Modified = TRUE;
3584 }
3585 else
3586 {
3587 GX_RADIAL_PROGRESS_BAR_INFO info = mpInfo->ewi.radial_progress;
3588
3589 info.gx_radial_progress_bar_info_xcenter = GetDlgItemInt(ID_RADIAL_PROGRESS_XCENTER, NULL, TRUE);;
3590 info.gx_radial_progress_bar_info_ycenter = GetDlgItemInt(ID_RADIAL_PROGRESS_YCENTER, NULL, TRUE);;
3591 info.gx_radial_progress_bar_info_radius = GetDlgItemInt(ID_RADIAL_PROGRESS_RADIUS, NULL, TRUE);;
3592 info.gx_radial_progress_bar_info_anchor_val = GetDlgItemInt(ID_RADIAL_PROGRESS_ANCHORVAL, NULL, TRUE);;
3593 info.gx_radial_progress_bar_info_current_val = GetDlgItemInt(ID_RADIAL_PROGRESS_CURRENTVAL, NULL, TRUE);;
3594 info.gx_radial_progress_bar_info_normal_brush_width = GetDlgItemInt(ID_RADIAL_PROGRESS_NORMAL_BRUSH_WIDTH, NULL, TRUE);;
3595 info.gx_radial_progress_bar_info_selected_brush_width = GetDlgItemInt(ID_RADIAL_PROGRESS_SELECTED_BRUSH_WIDTH, NULL, TRUE);;
3596
3597 CComboBox *pBrushColor = (CComboBox *)GetDlgItem(ID_RADIAL_PROGRESS_NORMAL_BRUSH_COLOR);
3598
3599 if (pBrushColor)
3600 {
3601 int box_index = pBrushColor->GetCurSel();
3602
3603 info.gx_radial_progress_bar_info_normal_brush_color = pBrushColor->GetItemData(box_index);
3604 }
3605
3606 pBrushColor = (CComboBox *)GetDlgItem(ID_RADIAL_PROGRESS_SELECTED_BRUSH_COLOR);
3607
3608 if (pBrushColor)
3609 {
3610 int box_index = pBrushColor->GetCurSel();
3611
3612 info.gx_radial_progress_bar_info_selected_brush_color = pBrushColor->GetItemData(box_index);
3613 }
3614
3615 if (memcmp(&info, &mpInfo->ewi.radial_progress, sizeof(GX_RADIAL_PROGRESS_BAR_INFO)))
3616 {
3617 UndoManager()->AddEntry(UNDO_TYPE_RADIAL_PROGRES_BAR_INFO, mpInfo);
3618 mpInfo->ewi.radial_progress = info;
3619 gx_radial_progress_bar_info_set((GX_RADIAL_PROGRESS_BAR *)mpInfo->widget, &mpInfo->ewi.radial_progress);
3620 Is_Modified = TRUE;
3621 }
3622 }
3623
3624 if (Is_Modified)
3625 {
3626 mpProject->SetModified();
3627 }
3628 }
3629 }
3630
3631 ///////////////////////////////////////////////////////////////////////////////
OnChangeChartInfo()3632 void properties_win::OnChangeChartInfo()
3633 {
3634 if (mpProject && mpInfo && GetDlgItem(ID_CHART_AXIS_COLOR))
3635 {
3636 GX_LINE_CHART_INFO chart_info;
3637 int box_index;
3638 int colorId;
3639
3640 CComboBox *pColorBox = (CComboBox *)GetDlgItem(ID_CHART_AXIS_COLOR);
3641 if (pColorBox)
3642 {
3643 box_index = pColorBox->GetCurSel();
3644 colorId = pColorBox->GetItemData(box_index);
3645 chart_info.gx_line_chart_axis_color = colorId;
3646 }
3647
3648 pColorBox = (CComboBox *)GetDlgItem(ID_CHART_LINE_COLOR);
3649 if (pColorBox)
3650 {
3651 box_index = pColorBox->GetCurSel();
3652 colorId = pColorBox->GetItemData(box_index);
3653 chart_info.gx_line_chart_line_color = colorId;
3654 }
3655
3656 chart_info.gx_line_chart_min_val = GetDlgItemInt(ID_CHART_MIN_VAL, NULL, TRUE);
3657 chart_info.gx_line_chart_max_val = GetDlgItemInt(ID_CHART_MAX_VAL, NULL, TRUE);
3658
3659 chart_info.gx_line_chart_left_margin = GetDlgItemInt(ID_CHART_LEFT_MARGIN, NULL, TRUE);
3660 chart_info.gx_line_chart_top_margin = GetDlgItemInt(ID_CHART_TOP_MARGIN, NULL, TRUE);
3661 chart_info.gx_line_chart_right_margin = GetDlgItemInt(ID_CHART_RIGHT_MARGIN, NULL, TRUE);
3662 chart_info.gx_line_chart_bottom_margin = GetDlgItemInt(ID_CHART_BOTTOM_MARGIN, NULL, TRUE);
3663
3664 chart_info.gx_line_chart_min_val = GetDlgItemInt(ID_CHART_MIN_VAL, NULL, TRUE);
3665 chart_info.gx_line_chart_min_val = GetDlgItemInt(ID_CHART_MIN_VAL, NULL, TRUE);
3666 chart_info.gx_line_chart_min_val = GetDlgItemInt(ID_CHART_MIN_VAL, NULL, TRUE);
3667 chart_info.gx_line_chart_max_data_count = GetDlgItemInt(ID_CHART_MAX_COUNT, NULL, TRUE);
3668 chart_info.gx_line_chart_axis_line_width = GetDlgItemInt(ID_CHART_AXIS_WIDTH, NULL, TRUE);
3669 chart_info.gx_line_chart_data_line_width = GetDlgItemInt(ID_CHART_LINE_WIDTH, NULL, TRUE);
3670
3671 chart_info.gx_line_chart_active_data_count = 0;
3672 chart_info.gx_line_chart_data = NULL;
3673
3674 if (memcmp(&chart_info, &mpInfo->ewi.line_chart_info, sizeof(GX_LINE_CHART_INFO)))
3675 {
3676 UndoManager()->AddEntry(UNDO_TYPE_CHART_INFO, mpInfo);
3677
3678 mpInfo->ewi.line_chart_info = chart_info;
3679
3680 GX_LINE_CHART *chart = (GX_LINE_CHART *)mpInfo->widget;
3681 chart->gx_line_chart_info = chart_info;
3682 gx_system_dirty_mark((GX_WIDGET *)chart);
3683
3684 mpProject->SetModified();
3685 }
3686 }
3687 }
3688
3689 ///////////////////////////////////////////////////////////////////////////////
OnChangeRadialSliderInfo()3690 void properties_win::OnChangeRadialSliderInfo()
3691 {
3692 if (mpProject && mpInfo && GetDlgItem(ID_RADIAL_SLIDER_XCENTER))
3693 {
3694 radial_slider_info info = mpInfo->ewi.radial_slider;
3695
3696 info.xcenter = GetDlgItemInt(ID_RADIAL_SLIDER_XCENTER, NULL, TRUE);
3697 info.ycenter = GetDlgItemInt(ID_RADIAL_SLIDER_YCENTER, NULL, TRUE);
3698 info.radius = GetDlgItemInt(ID_RADIAL_SLIDER_RADIUS, NULL, TRUE);
3699 info.track_width = GetDlgItemInt(ID_RADIAL_SLIDER_TRACK_WIDTH, NULL, TRUE);
3700 info.needle_offset = GetDlgItemInt(ID_RADIAL_SLIDER_NEEDLE_OFFSET, NULL, TRUE);
3701 info.current_angle = GetDlgItemInt(ID_RADIAL_SLIDER_CURRENT_ANGLE, NULL, TRUE);
3702 info.min_angle = GetDlgItemInt(ID_RADIAL_SLIDER_MIN_ANGLE, NULL, TRUE);
3703 info.max_angle = GetDlgItemInt(ID_RADIAL_SLIDER_MAX_ANGLE, NULL, TRUE);
3704 info.animation_total_steps = GetDlgItemInt(ID_RADIAL_SLIDER_TOTAL_STEPS, NULL, TRUE);
3705 info.animation_delay = GetDlgItemInt(ID_RADIAL_SLIDER_DELAY, NULL, TRUE);
3706
3707 CComboBox *pBox = (CComboBox *)GetDlgItem(ID_RADIAL_SLIDER_ANIMATION_STYLE);
3708 int box_index = pBox->GetCurSel();
3709 info.animation_style = (GX_VALUE)pBox->GetItemData(box_index);
3710
3711 if (memcmp(&info, &mpInfo->ewi.radial_slider, sizeof(radial_slider_info)))
3712 {
3713 UndoManager()->AddEntry(UNDO_TYPE_RADIAL_SLIDER_INFO, mpInfo);
3714
3715 radial_slider_service_provider *provider = (radial_slider_service_provider *)widget_factory::GetServiceProvider(mpInfo->basetype);
3716 provider->SetRadialSliderInfo(mpInfo, &info);
3717 mpProject->SetModified();
3718 }
3719 }
3720 }
3721
3722 ///////////////////////////////////////////////////////////////////////////////
OnSpriteStyleChange()3723 void properties_win::OnSpriteStyleChange()
3724 {
3725 if (mpProject && mpInfo && GetDlgItem(ID_SPRITE_AUTO))
3726 {
3727 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
3728
3729 if (IsDlgButtonChecked(ID_SPRITE_AUTO))
3730 {
3731 mpInfo->style |= GX_STYLE_SPRITE_AUTO;
3732 }
3733 else
3734 {
3735 mpInfo->style &= ~GX_STYLE_SPRITE_AUTO;
3736 }
3737 if (IsDlgButtonChecked(ID_SPRITE_LOOP))
3738 {
3739 mpInfo->style |= GX_STYLE_SPRITE_LOOP;
3740 }
3741 else
3742 {
3743 mpInfo->style &= ~GX_STYLE_SPRITE_LOOP;
3744 }
3745
3746 // we don't update the sprite instance, because we don't want it running
3747 // inside Studio.
3748 mpProject->SetModified();
3749 }
3750 }
3751
3752 ///////////////////////////////////////////////////////////////////////////////
OnEditSpriteFrames()3753 void properties_win::OnEditSpriteFrames()
3754 {
3755 sprite_edit_dialog dlg(mpInfo, this);
3756 if (dlg.DoModal() == IDOK)
3757 {
3758 GX_SPRITE *sprite = (GX_SPRITE *)mpInfo->widget;
3759
3760 if (sprite)
3761 {
3762 gx_sprite_frame_list_set(sprite, mpInfo->ewi.sprite.framelist, mpInfo->ewi.sprite.frame_count);
3763 mpProject->SetModified();
3764 }
3765
3766 GetDlgItem(ID_SPRITE_EDIT_FRAMES)->SetFocus();
3767 }
3768 }
3769
3770 ///////////////////////////////////////////////////////////////////////////////
OnChangeGaugeInfo()3771 void properties_win::OnChangeGaugeInfo()
3772 {
3773 if (mpProject && mpInfo && GetDlgItem(ID_GAUGE_START_ANGLE))
3774 {
3775 GX_CIRCULAR_GAUGE_INFO gauge_info = mpInfo->ewi.gauge.info;
3776 INT start_angle = mpInfo->ewi.gauge.start_angle;
3777
3778 start_angle = GetDlgItemInt(ID_GAUGE_START_ANGLE, NULL, TRUE);
3779 gauge_info.gx_circular_gauge_info_animation_steps = GetDlgItemInt(ID_GAUGE_ANIMATION_STEPS, NULL, TRUE);
3780 gauge_info.gx_circular_gauge_info_animation_delay = GetDlgItemInt(ID_GAUGE_ANIMATION_DELAY, NULL, TRUE);
3781 gauge_info.gx_circular_gauge_info_needle_xpos = GetDlgItemInt(ID_GAUGE_NEEDLE_XPOS, NULL, TRUE);
3782 gauge_info.gx_circular_gauge_info_needle_ypos = GetDlgItemInt(ID_GAUGE_NEEDLE_YPOS, NULL, TRUE);
3783 gauge_info.gx_circular_gauge_info_needle_xcor = GetDlgItemInt(ID_GAUGE_NEEDLE_XCOR, NULL, TRUE);
3784 gauge_info.gx_circular_gauge_info_needle_ycor = GetDlgItemInt(ID_GAUGE_NEEDLE_YCOR, NULL, TRUE);
3785
3786 if (memcmp(&gauge_info, &mpInfo->ewi.gauge.info, sizeof(GX_CIRCULAR_GAUGE_INFO)) ||
3787 (start_angle != mpInfo->ewi.gauge.start_angle))
3788 {
3789 UndoManager()->AddEntry(UNDO_TYPE_CIRCULAR_GAUGE_INFO, mpInfo);
3790
3791 GX_CIRCULAR_GAUGE *gauge = (GX_CIRCULAR_GAUGE *)mpInfo->widget;
3792 mpInfo->ewi.gauge.info = gauge_info;
3793 mpInfo->ewi.gauge.start_angle = start_angle;
3794 gauge->gx_circular_gauge_info = mpInfo->ewi.gauge.info;
3795 gx_system_dirty_mark((GX_WIDGET *)gauge);
3796
3797 mpProject->SetModified();
3798 }
3799 }
3800 }
3801
3802 ///////////////////////////////////////////////////////////////////////////////
OnChangeScrollWheelProps()3803 void properties_win::OnChangeScrollWheelProps()
3804 {
3805 if (mpProject && mpInfo && GetDlgItem(ID_XPOS))
3806 {
3807 scroll_wheel_info wheel_info = mpInfo->ewi.scroll_wheel;
3808
3809 wheel_info.total_rows = GetDlgItemInt(ID_SCROLL_WHEEL_TOTAL_ROWS, NULL, FALSE);
3810 wheel_info.selected_row = GetDlgItemInt(ID_SCROLL_WHEEL_SELECTED_ROW, NULL, FALSE);
3811 wheel_info.start_alpha = GetDlgItemInt(ID_SCROLL_WHEEL_START_ALPHA, NULL, FALSE);
3812 wheel_info.end_alpha = GetDlgItemInt(ID_SCROLL_WHEEL_END_ALPHA, NULL, FALSE);
3813 wheel_info.row_height = GetDlgItemInt(ID_SCROLL_WHEEL_ROW_HEIHGT, NULL, FALSE);
3814
3815 if (memcmp(&wheel_info, &mpInfo->ewi.scroll_wheel, sizeof(scroll_wheel_info)))
3816 {
3817 UndoManager()->AddEntry(UNDO_TYPE_SCROLL_WHEEL_INFO, mpInfo);
3818
3819 scroll_wheel_service_provider *provider = (scroll_wheel_service_provider *) widget_factory::GetServiceProvider(mpInfo->basetype);
3820
3821 if (provider)
3822 {
3823 provider->AssignScrollWheelInfo(mpInfo, &wheel_info);
3824 }
3825
3826 mpProject->SetModified();
3827 }
3828 }
3829 }
3830
3831 ///////////////////////////////////////////////////////////////////////////////
OnChangeTextScrollWheelProps()3832 void properties_win::OnChangeTextScrollWheelProps()
3833 {
3834 if (mpProject && mpInfo && GetDlgItem(ID_XPOS))
3835 {
3836 ULONG style = mpInfo->style;
3837
3838 CComboBox *pFontBox = (CComboBox *)GetDlgItem(ID_TEXT_SCROLL_WHEEL_NORMAL_FONT);
3839 int box_index = pFontBox->GetCurSel();
3840 int normal_font = pFontBox->GetItemData(box_index);
3841
3842 pFontBox = (CComboBox *)GetDlgItem(ID_TEXT_SCROLL_WHEEL_SELECTED_FONT);
3843 box_index = pFontBox->GetCurSel();
3844 int selected_font = pFontBox->GetItemData(box_index);
3845
3846 if (IsDlgButtonChecked(ID_TEXT_SCROLL_WHEEL_ROUND))
3847 {
3848 style |= GX_STYLE_TEXT_SCROLL_WHEEL_ROUND;
3849 }
3850 else
3851 {
3852 style &= ~GX_STYLE_TEXT_SCROLL_WHEEL_ROUND;
3853 }
3854
3855 if (style != mpInfo->style)
3856 {
3857 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
3858
3859 mpInfo->style = style;
3860 gx_widget_style_set(mpInfo->widget, mpInfo->style);
3861
3862 mpProject->SetModified();
3863 }
3864 else if ((normal_font != mpInfo->font_id[NORMAL_FONT_INDEX]) ||
3865 (selected_font != mpInfo->font_id[SELECTED_FONT_INDEX]))
3866 {
3867 UndoManager()->AddEntry(UNDO_TYPE_TEXT_SCROLL_WHEEL_INFO, mpInfo);
3868
3869 text_scroll_wheel_service_provider *provider = (text_scroll_wheel_service_provider *)widget_factory::GetServiceProvider(mpInfo->basetype);
3870
3871 if (provider)
3872 {
3873 provider->AssignFont(mpInfo, NORMAL_FONT_INDEX, normal_font);
3874 provider->AssignFont(mpInfo, SELECTED_FONT_INDEX, selected_font);
3875 }
3876
3877 mpProject->SetModified();
3878 }
3879 }
3880 }
3881
3882 ///////////////////////////////////////////////////////////////////////////////
OnChangeStringScrollWheelProps()3883 void properties_win::OnChangeStringScrollWheelProps()
3884 {
3885 if (mpProject && mpInfo && GetDlgItem(ID_XPOS))
3886 {
3887 CString callback;
3888
3889 GetDlgItemText(ID_CALLBACK_NAME, callback);
3890
3891 if (callback.IsEmpty())
3892 {
3893 GetDlgItem(ID_STRING_SCROLL_WHEEL_EDIT_STRINGS)->EnableWindow(TRUE);
3894 }
3895 else
3896 {
3897 GetDlgItem(ID_STRING_SCROLL_WHEEL_EDIT_STRINGS)->EnableWindow(FALSE);
3898 }
3899
3900 if (callback != mpInfo->callback_func)
3901 {
3902 UndoManager()->AddEntry(UNDO_TYPE_STRING_SCROLL_WHEEL_INFO, mpInfo);
3903 string_scroll_wheel_service_provider *provider = (string_scroll_wheel_service_provider *)widget_factory::GetServiceProvider(mpInfo->basetype);
3904
3905 if (provider)
3906 {
3907 provider->StringEditEnableDisable(mpInfo, callback.IsEmpty());
3908 }
3909
3910 mpInfo->callback_func = callback;
3911
3912 mpProject->SetModified();
3913 }
3914 }
3915 }
3916
3917 ///////////////////////////////////////////////////////////////////////////////
OnEditStringScrolWheelStrings()3918 void properties_win::OnEditStringScrolWheelStrings()
3919 {
3920 string_scroll_wheel_service_provider *provider;
3921 provider = (string_scroll_wheel_service_provider *)widget_factory::GetServiceProvider(mpInfo->basetype);
3922
3923 if (mpProject && mpInfo && provider && GetDlgItem(ID_XPOS))
3924 {
3925 if (!mpInfo->ewi.string_scroll_wheel.base.total_rows)
3926 {
3927 ErrorMsg(L"Please set total rows first.", this);
3928 }
3929 else
3930 {
3931
3932 CArray<GX_RESOURCE_ID> list_array;
3933
3934 provider->InitStringIdListArray(mpInfo->ewi.string_scroll_wheel.string_id_list, mpInfo->ewi.string_scroll_wheel.base.total_rows, list_array);
3935
3936 int display = mpProject->GetDisplayIndex(mpInfo);
3937 string_scroll_wheel_edit_dlg dlg(display, &list_array, this);
3938
3939 if (dlg.DoModal() == IDOK)
3940 {
3941 UndoManager()->AddEntry(UNDO_TYPE_STRING_SCROLL_WHEEL_INFO, mpInfo);
3942
3943 if (mpInfo->ewi.string_scroll_wheel.string_id_list)
3944 {
3945 delete mpInfo->ewi.string_scroll_wheel.string_id_list;
3946 mpInfo->ewi.string_scroll_wheel.string_id_list = NULL;
3947 }
3948
3949 provider->CreateStringIdList(mpInfo, list_array);
3950
3951 mpProject->SetModified();
3952 }
3953 }
3954
3955 GetDlgItem(ID_STRING_SCROLL_WHEEL_EDIT_STRINGS)->SetFocus();
3956 }
3957 }
3958
3959 ///////////////////////////////////////////////////////////////////////////////
OnChangeNumericScrollWheelRange()3960 afx_msg void properties_win::OnChangeNumericScrollWheelRange()
3961 {
3962 if (mpProject && mpInfo && GetDlgItem(ID_XPOS))
3963 {
3964 int start_val = GetDlgItemInt(ID_NUMERIC_SCROLL_WHEEL_START_VAL, FALSE, TRUE);
3965 int end_val = GetDlgItemInt(ID_NUMERIC_SCROLL_WHEEL_END_VAL, FALSE, TRUE);
3966
3967 if ((start_val != mpInfo->ewi.numeric_scroll_wheel.start_val) ||
3968 (end_val != mpInfo->ewi.numeric_scroll_wheel.end_val))
3969 {
3970 numeric_scroll_wheel_service_provider *provider = (numeric_scroll_wheel_service_provider *)widget_factory::GetServiceProvider(mpInfo->basetype);
3971 if (provider)
3972 {
3973 UndoManager()->AddEntry(UNDO_TYPE_NUMRIC_SCROLL_WHEEL_INFO, mpInfo);
3974
3975 if (mpInfo->ewi.numeric_scroll_wheel.base.total_rows != 0)
3976 {
3977 mpInfo->ewi.numeric_scroll_wheel.base.total_rows = 0;
3978 SetDlgItemInt(ID_SCROLL_WHEEL_TOTAL_ROWS, 0);
3979 }
3980 provider->AssignValueRange(mpInfo, start_val, end_val);
3981 mpProject->SetModified();
3982 }
3983 }
3984 }
3985 }
3986
3987 ///////////////////////////////////////////////////////////////////////////////
OnChangeListWrap()3988 void properties_win::OnChangeListWrap()
3989 {
3990 CButton *pb = (CButton *)GetDlgItem(ID_LIST_WRAP);
3991
3992 if (mpProject && mpInfo && pb)
3993 {
3994 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
3995
3996 if (pb->GetCheck() == BST_CHECKED)
3997 {
3998 mpInfo->style |= GX_STYLE_WRAP;
3999 }
4000 else
4001 {
4002 mpInfo->style &= ~GX_STYLE_WRAP;
4003 }
4004 gx_widget_style_set(mpInfo->widget, mpInfo->style);
4005 mpProject->SetModified();
4006 }
4007 }
4008
4009 ///////////////////////////////////////////////////////////////////////////////
OnChangeListRepeatSelect()4010 void properties_win::OnChangeListRepeatSelect()
4011 {
4012 CButton *pb = (CButton *)GetDlgItem(ID_LIST_REPEAT_SELECT);
4013
4014 if (mpProject && mpInfo && pb)
4015 {
4016 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
4017
4018 if (pb->GetCheck() == BST_CHECKED)
4019 {
4020 mpInfo->style |= GX_STYLE_REPEAT_SELECT;
4021 }
4022 else
4023 {
4024 mpInfo->style &= ~GX_STYLE_REPEAT_SELECT;
4025 }
4026 gx_widget_style_set(mpInfo->widget, mpInfo->style);
4027 mpProject->SetModified();
4028 }
4029 }
4030
4031
4032 ///////////////////////////////////////////////////////////////////////////////
OnChangeListRows()4033 void properties_win::OnChangeListRows()
4034 {
4035 if (mpProject && mpInfo && GetDlgItem(ID_LIST_ROWS))
4036 {
4037 INT total_rows;
4038
4039 switch(mpInfo->basetype)
4040 {
4041 case GX_TYPE_VERTICAL_LIST:
4042 case GX_TYPE_HORIZONTAL_LIST:
4043 total_rows = GetDlgItemInt(ID_LIST_ROWS, NULL, TRUE);
4044
4045 if (total_rows != mpInfo->ewi.vlist.total_rows)
4046 {
4047 UndoManager()->AddEntry(UNDO_TYPE_LIST_ROWS, mpInfo);
4048 mpInfo->ewi.vlist.total_rows = total_rows;
4049 mpProject->SetModified();
4050 }
4051 break;
4052
4053 case GX_TYPE_DROP_LIST:
4054 total_rows = GetDlgItemInt(ID_LIST_ROWS, NULL, TRUE);
4055
4056 if (total_rows != mpInfo->ewi.drop_list.total_rows)
4057 {
4058 UndoManager()->AddEntry(UNDO_TYPE_LIST_ROWS, mpInfo);
4059 mpInfo->ewi.drop_list.total_rows = total_rows;
4060 mpProject->SetModified();
4061 }
4062 break;
4063
4064 default:
4065 break;
4066 }
4067 }
4068 }
4069
4070 ///////////////////////////////////////////////////////////////////////////////
OnChangeOpenHeight()4071 void properties_win::OnChangeOpenHeight()
4072 {
4073 if (mpProject && mpInfo && GetDlgItem(ID_OPEN_HEIGHT))
4074 {
4075 INT open_height = GetDlgItemInt(ID_OPEN_HEIGHT, NULL, TRUE);
4076
4077 if (open_height != mpInfo->ewi.drop_list.open_height)
4078 {
4079 UndoManager()->AddEntry(UNDO_TYPE_OPEN_HEIGHT, mpInfo);
4080
4081 mpInfo->ewi.drop_list.open_height = open_height;
4082
4083 GX_DROP_LIST *drop = (GX_DROP_LIST *)mpInfo->widget;
4084 if (drop->gx_drop_list_popup_open)
4085 {
4086 gx_drop_list_close(drop);
4087 gx_drop_list_open(drop);
4088 }
4089 mpProject->SetModified();
4090 }
4091 }
4092 }
4093
4094 ///////////////////////////////////////////////////////////////////////////////
OnChangeTextViewLineSpace()4095 void properties_win::OnChangeTextViewLineSpace()
4096 {
4097 if (mpProject && mpInfo && GetDlgItem(ID_TEXT_VIEW_LINE_SPACE))
4098 {
4099
4100 int line_space = GetDlgItemInt(ID_TEXT_VIEW_LINE_SPACE);
4101
4102 if (line_space != mpInfo->ewi.text_info.line_space)
4103 {
4104 if ((line_space < -128) || (line_space > 127))
4105 {
4106 Notify("Invalid value for line space. Valid range is from -128 to 127.", this);
4107 SetDlgItemInt(ID_TEXT_VIEW_LINE_SPACE, mpInfo->ewi.text_info.line_space);
4108 }
4109 else
4110 {
4111 UndoManager()->AddEntry(UNDO_TYPE_TEXT_VIEW_LINE_SPACE, mpInfo);
4112
4113 mpInfo->ewi.text_info.line_space = line_space;
4114 gx_multi_line_text_view_line_space_set((GX_MULTI_LINE_TEXT_VIEW*)mpInfo->widget, line_space);
4115
4116 mpProject->SetModified();
4117 }
4118 }
4119 }
4120 }
4121
4122 ///////////////////////////////////////////////////////////////////////////////
OnChangeTextViewWhitespace()4123 void properties_win::OnChangeTextViewWhitespace()
4124 {
4125 if (mpProject && mpInfo && GetDlgItem(ID_TEXT_VIEW_WHITESPACE))
4126 {
4127 int whitespace = GetDlgItemInt(ID_TEXT_VIEW_WHITESPACE);
4128
4129 if (whitespace != mpInfo->ewi.text_info.whitespace)
4130 {
4131 if ((whitespace < 0) || (whitespace > 255))
4132 {
4133 Notify("Invalid value for whitespace. Valid range is from 0 to 255.", this);
4134 SetDlgItemInt(ID_TEXT_VIEW_WHITESPACE, mpInfo->ewi.text_info.whitespace);
4135 }
4136 else
4137 {
4138 UndoManager()->AddEntry(UNDO_TYPE_TEXT_VIEW_WHITESPACE, mpInfo);
4139
4140 mpInfo->ewi.text_info.whitespace = whitespace;
4141 gx_multi_line_text_view_whitespace_set((GX_MULTI_LINE_TEXT_VIEW*)mpInfo->widget, whitespace);
4142
4143 mpProject->SetModified();
4144 }
4145 }
4146 }
4147 }
4148
4149 ///////////////////////////////////////////////////////////////////////////////
OnChangeTextBufferSize(void)4150 void properties_win::OnChangeTextBufferSize(void)
4151 {
4152 GX_SINGLE_LINE_TEXT_INPUT *pi;
4153 GX_MULTI_LINE_TEXT_INPUT *mi;
4154
4155 if (mpProject && mpInfo && GetDlgItemInt(ID_BUFFER_SIZE))
4156 {
4157 int newsize = GetDlgItemInt(ID_BUFFER_SIZE);
4158 if (newsize == 1 || newsize > (100 * 1024))
4159 {
4160 SetDlgItemInt(ID_BUFFER_SIZE, mpInfo->ewi.text_info.buffer_size);
4161 return;
4162 }
4163
4164 if (newsize != mpInfo->ewi.text_info.buffer_size)
4165 {
4166 UndoManager()->AddEntry(UNDO_TYPE_TEXT_BUFFER_SIZE, mpInfo);
4167
4168 if (newsize > mpInfo->ewi.text_info.buffer_size)
4169 {
4170 // allocate a new buffer and delete the old one
4171
4172 GX_CHAR *newbuffer = new GX_CHAR[newsize + 1];
4173 GX_CHAR *oldbuffer = NULL;
4174
4175 if (mpInfo->widget)
4176 {
4177 switch (mpInfo->basetype)
4178 {
4179 case GX_TYPE_SINGLE_LINE_TEXT_INPUT:
4180 pi = (GX_SINGLE_LINE_TEXT_INPUT *)mpInfo->widget;
4181 oldbuffer = pi->gx_single_line_text_input_buffer;
4182 pi->gx_single_line_text_input_buffer = newbuffer;
4183 break;
4184
4185 case GX_TYPE_MULTI_LINE_TEXT_INPUT:
4186 mi = (GX_MULTI_LINE_TEXT_INPUT *)mpInfo->widget;
4187 oldbuffer = (GX_CHAR *) mi->gx_multi_line_text_view_text.gx_string_ptr;
4188 mi->gx_multi_line_text_view_text.gx_string_ptr = newbuffer;
4189 break;
4190
4191 default:
4192 break;
4193 }
4194 }
4195 if (oldbuffer)
4196 {
4197 delete[] oldbuffer;
4198 }
4199 }
4200 mpInfo->ewi.text_info.buffer_size = newsize;
4201 if (mpInfo->string_id[0])
4202 {
4203 // if this guy has a string_id, re-assign the text:
4204 OnChangeStringId();
4205 }
4206 mpProject->SetModified();
4207 }
4208 }
4209 }
4210
4211 ///////////////////////////////////////////////////////////////////////////////
OnChangeStringId()4212 void properties_win::OnChangeStringId()
4213 {
4214 CComboBox *pbox = (CComboBox *) GetDlgItem(ID_STRING_ID);
4215 string_table *table = GetActiveStringTable();
4216
4217 if (mpProject && mpInfo && pbox && table)
4218 {
4219 int text_id = pbox->GetItemData(pbox->GetCurSel());
4220
4221 if ((mpInfo->string_id[0] != text_id) ||
4222 (mpInfo->basetype == GX_TYPE_MULTI_LINE_TEXT_INPUT) ||
4223 (mpInfo->basetype == GX_TYPE_SINGLE_LINE_TEXT_INPUT))
4224 {
4225 UndoManager()->AddEntry(UNDO_TYPE_STRING, mpInfo, 0);
4226 mpInfo->string_id[0] = text_id;
4227 widget_service_provider *provider = widget_factory::GetServiceProvider(mpInfo->basetype);
4228
4229 if (provider)
4230 {
4231 provider->AssignText(mpInfo, 0, text_id);
4232 }
4233 CRichEditCtrl *pEdit = (CRichEditCtrl *) GetDlgItem(ID_STRING_VAL);
4234 CString id_name = table->GetResourceIdName(text_id);
4235 SetUtf8Text(pEdit, table->GetString(id_name));
4236 mpProject->SetModified();
4237 }
4238 }
4239 }
4240
4241 ///////////////////////////////////////////////////////////////////////////////
OnChangeStringText()4242 void properties_win::OnChangeStringText()
4243 {
4244 CString tval;
4245
4246 string_table *table = GetActiveStringTable();
4247
4248 if (mpProject && mpInfo && table)
4249 {
4250 CRichEditCtrl *pEdit = (CRichEditCtrl *) GetDlgItem(ID_STRING_VAL);
4251
4252 if (pEdit == NULL)
4253 {
4254 return;
4255 }
4256 tval = GetUtf8Text(pEdit);
4257 if (!pEdit)
4258 {
4259 return;
4260 }
4261
4262 CComboBox *pbox = (CComboBox *) GetDlgItem(ID_STRING_ID);
4263
4264 if (!pbox)
4265 {
4266 return;
4267 }
4268 CString id_name;
4269 GX_RESOURCE_ID resource_id;
4270
4271 if (pbox)
4272 {
4273 resource_id = pbox->GetItemData(pbox->GetCurSel());
4274
4275 if (resource_id)
4276 {
4277 id_name = table->GetResourceIdName(resource_id);
4278
4279 if (table->GetString(id_name) == tval)
4280 {
4281 // no change, just return
4282 return;
4283 }
4284 }
4285
4286 if (!tval.IsEmpty())
4287 {
4288 int string_index = table->CheckAddString(tval);
4289 id_name = table->GetStringId(string_index);
4290 resource_id = table->GetResourceId(id_name);
4291
4292 table->Sort();
4293 GetResourceView()->RebuildStringItems();
4294 }
4295 else
4296 {
4297 resource_id = 0;
4298 }
4299
4300 // select this string id in drop down list. We might have
4301 // to add a new entry before selecting
4302 if (pbox->GetCount() == resource_id)
4303 {
4304 int index = pbox->AddString(id_name);
4305 pbox->SetItemData(index, resource_id);
4306 }
4307 SelectDropListItem(pbox, resource_id);
4308
4309 // assign this string id to the widget:
4310 widget_service_provider *provider = widget_factory::GetServiceProvider(mpInfo->basetype);
4311
4312 if (provider)
4313 {
4314 UndoManager()->AddEntry(UNDO_TYPE_STRING, mpInfo, 0);
4315 provider->AssignText(mpInfo, 0, resource_id);
4316 }
4317 mpProject->SetModified();
4318 }
4319 }
4320 }
4321
4322
4323 ///////////////////////////////////////////////////////////////////////////////
OnScrollAppearanceChange()4324 void properties_win::OnScrollAppearanceChange()
4325 {
4326 if (mpProject && mpInfo && GetDlgItem(ID_SCROLL_THUMB_COLOR))
4327 {
4328 GX_SCROLLBAR_APPEARANCE appearance = mpInfo->ewi.scroll;
4329
4330 CComboBox *pBox = (CComboBox *) GetDlgItem(ID_SCROLL_THUMB_COLOR);
4331
4332 if (pBox)
4333 {
4334 int box_index = pBox->GetCurSel();
4335 int ColorId = pBox->GetItemData(box_index);
4336 appearance.gx_scroll_thumb_color = ColorId;
4337 }
4338
4339 pBox = (CComboBox *) GetDlgItem(ID_SCROLL_THUMB_BORDER_COLOR);
4340
4341 if (pBox)
4342 {
4343 int box_index = pBox->GetCurSel();
4344 int ColorId = pBox->GetItemData(box_index);
4345 appearance.gx_scroll_thumb_border_color = ColorId;
4346 }
4347
4348 pBox = (CComboBox *) GetDlgItem(ID_SCROLL_BUTTON_COLOR);
4349
4350 if (pBox)
4351 {
4352 int box_index = pBox->GetCurSel();
4353 int ColorId = pBox->GetItemData(box_index);
4354 appearance.gx_scroll_button_color = ColorId;
4355 }
4356
4357 pBox = (CComboBox *) GetDlgItem(ID_SCROLL_THUMB_BORDER_STYLE);
4358 if (pBox)
4359 {
4360 int Selected = pBox->GetCurSel();
4361 GX_UBYTE style = (GX_UBYTE) pBox->GetItemData(Selected);
4362 appearance.gx_scroll_thumb_border_style = style;
4363 }
4364
4365 if (mpInfo->widget->gx_widget_style & GX_SCROLLBAR_VERTICAL)
4366 {
4367 appearance.gx_scroll_width = GetDlgItemInt(ID_WIDTH, NULL, TRUE);
4368 }
4369 else
4370 {
4371 appearance.gx_scroll_width = GetDlgItemInt(ID_HEIGHT, NULL, TRUE);
4372 }
4373 appearance.gx_scroll_thumb_width = GetDlgItemInt(ID_THUMB_WIDTH, NULL, TRUE);
4374 appearance.gx_scroll_thumb_travel_min = GetDlgItemInt(ID_THUMB_TRAVEL_MIN, NULL, TRUE);
4375 appearance.gx_scroll_thumb_travel_max = GetDlgItemInt(ID_THUMB_TRAVEL_MAX, NULL, TRUE);
4376
4377 if (memcmp(&appearance, &mpInfo->ewi.scroll, sizeof(GX_SCROLLBAR_APPEARANCE)))
4378 {
4379 UndoManager()->AddEntry(UNDO_TYPE_SCROLL_APPEARANCE, mpInfo);
4380
4381 widget_factory::ReplaceScrollbar(mpInfo, &appearance);
4382 mpProject->SetModified();
4383 }
4384 }
4385 }
4386
4387 ///////////////////////////////////////////////////////////////////////////////
OnScrollStyleChange()4388 void properties_win::OnScrollStyleChange()
4389 {
4390 if (!mpProject || !mpInfo || !GetDlgItem(ID_SCROLL_END_BUTTONS))
4391 {
4392 return;
4393 }
4394
4395 ULONG style = mpInfo->style;
4396
4397 CButton *pb = (CButton *) GetDlgItem(ID_SCROLL_END_BUTTONS);
4398 if (pb)
4399 {
4400 if (pb->GetCheck() == BST_CHECKED)
4401 {
4402 style |= GX_SCROLLBAR_END_BUTTONS;
4403 }
4404 else
4405 {
4406 style &= ~GX_SCROLLBAR_END_BUTTONS;
4407 }
4408 }
4409 pb = (CButton *) GetDlgItem(ID_SCROLL_TILE_BKGND);
4410 if (pb)
4411 {
4412 if (pb->GetCheck() == BST_CHECKED)
4413 {
4414 style |= GX_STYLE_TILE_BACKGROUND;
4415 }
4416 else
4417 {
4418 style &= ~GX_STYLE_TILE_BACKGROUND;
4419 }
4420 }
4421 pb = (CButton *) GetDlgItem(ID_SCROLL_RELATIVE_THUMB);
4422 if (pb)
4423 {
4424 if (pb->GetCheck() == BST_CHECKED)
4425 {
4426 style |= GX_SCROLLBAR_RELATIVE_THUMB;
4427 }
4428 else
4429 {
4430 style &= ~GX_SCROLLBAR_RELATIVE_THUMB;
4431 }
4432 }
4433
4434 if (style != mpInfo->style)
4435 {
4436 UndoManager()->AddEntry(UNDO_TYPE_SCROLL_STYLE, mpInfo);
4437
4438 mpInfo->style = style;
4439 GX_SCROLLBAR_APPEARANCE appearance = mpInfo->ewi.scroll;
4440 widget_factory::ReplaceScrollbar(mpInfo, &appearance);
4441
4442 mpProject->SetModified();
4443 }
4444 }
4445
4446 ///////////////////////////////////////////////////////////////////////////////
OnChangeTemplate()4447 void properties_win::OnChangeTemplate()
4448 {
4449 CButton *pb = (CButton *)GetDlgItem(ID_TEMPLATE);
4450 BOOL check;
4451
4452 if (mpProject && mpInfo && mpInfo->widget && pb)
4453 {
4454 check = pb->GetCheck();
4455 // We always check valid name when edit widget name, no need to check again
4456
4457 if (check)
4458 {
4459 if (!widget_factory::FindBaseName(mpInfo->app_name))
4460 {
4461 UndoManager()->AddEntry(UNDO_TYPE_TEMPLATE, mpInfo);
4462 mpInfo->is_template = check;
4463
4464 // templates cannot be dynamically allocated, only widgets derived from templates
4465 // are dynammically allocated
4466 mpInfo->allocation = STATICALLY_ALLOCATED;
4467 SetChildAllocation(mpInfo->GetChildWidgetInfo(), STATICALLY_ALLOCATED);
4468 }
4469 else
4470 {
4471 ErrorMsg("Template name already exists.");
4472 pb->SetFocus();
4473 pb->SetCheck(FALSE);
4474 mpInfo->is_template = FALSE;
4475 }
4476 }
4477 else
4478 {
4479 if (template_service_provider::CountDerivedWidgets(mpInfo) == 0)
4480 {
4481 // OK to remove template status from this widget:
4482 UndoManager()->AddEntry(UNDO_TYPE_TEMPLATE, mpInfo);
4483 mpInfo->is_template = check;
4484 }
4485 else
4486 {
4487 ErrorMsg("This template cannot be removed until all derived widgets are first deleted.");
4488 pb->SetCheck(TRUE);
4489 mpInfo->is_template = TRUE;
4490 }
4491 }
4492
4493 mpProject->SetModified();
4494 }
4495 }
4496
4497 ///////////////////////////////////////////////////////////////////////////////
OnChangeVisibleAtStartup()4498 void properties_win::OnChangeVisibleAtStartup()
4499 {
4500 if (mpProject && mpInfo && GetDlgItem(ID_WIDGET_NAME))
4501 {
4502 UndoManager()->AddEntry(UNDO_TYPE_VISIBLE_AT_STARTUP, mpInfo);
4503
4504 if (IsDlgButtonChecked(ID_VISIBLE_AT_STARTUP))
4505 {
4506 mpInfo->visible_at_startup = TRUE;
4507 }
4508 else
4509 {
4510 mpInfo->visible_at_startup = FALSE;
4511 }
4512
4513 mpProject->SetModified();
4514 }
4515 }
4516
4517 ///////////////////////////////////////////////////////////////////////////////
4518 ///////////////////////////////////////////////////////////////////////////////
OnChangeMenuInfo()4519 void properties_win::OnChangeMenuInfo()
4520 {
4521 if (!mpProject || !mpInfo || !GetDlgItem(ID_MENU_EXPANDED))
4522 {
4523 return;
4524 }
4525
4526 ULONG style = mpInfo->style;
4527
4528 CButton *pb = (CButton *)GetDlgItem(ID_MENU_EXPANDED);
4529 if (pb)
4530 {
4531 if (pb->GetCheck() == BST_CHECKED)
4532 {
4533 style |= GX_STYLE_MENU_EXPANDED;
4534 }
4535 else
4536 {
4537 style &= ~GX_STYLE_MENU_EXPANDED;
4538 }
4539 }
4540
4541 menu_service_provider *provider = (menu_service_provider *)widget_factory::GetServiceProvider(mpInfo->basetype);
4542
4543 if (style != mpInfo->style)
4544 {
4545 UndoManager()->AddEntry(UNDO_TYPE_MENU_INFO, mpInfo);
4546
4547 provider->AssignStyle(mpInfo, style);
4548 mpProject->SetModified();
4549 return;
4550 }
4551
4552 int text_x_offset = GetDlgItemInt(ID_MENU_TEXT_X_OFFSET, NULL, TRUE);
4553 int text_y_offset = GetDlgItemInt(ID_MENU_TEXT_Y_OFFSET, NULL, TRUE);
4554
4555 int insert_as_menu_item;
4556 pb = (CButton *)GetDlgItem(ID_MENU_INSERT_MODE);
4557 if (pb)
4558 {
4559 insert_as_menu_item = pb->GetCheck();
4560 }
4561
4562 if ((text_x_offset != mpInfo->ewi.menu.text_x_offset) ||
4563 (text_y_offset != mpInfo->ewi.menu.text_y_offset) ||
4564 (insert_as_menu_item != mpInfo->ewi.menu.insert_as_menu_item))
4565 {
4566 UndoManager()->AddEntry(UNDO_TYPE_MENU_INFO, mpInfo);
4567 mpInfo->ewi.menu.insert_as_menu_item = insert_as_menu_item;
4568
4569 provider->AssignTextOffset(mpInfo, text_x_offset, text_y_offset);
4570 }
4571 }
4572
4573 ///////////////////////////////////////////////////////////////////////////////
OnChangeTreeViewInfo()4574 void properties_win::OnChangeTreeViewInfo()
4575 {
4576 if (!mpProject || !mpInfo || !GetDlgItem(ID_TREE_VIEW_INDENTATION))
4577 {
4578 return;
4579 }
4580
4581 int indentation;
4582 indentation = GetDlgItemInt(ID_TREE_VIEW_INDENTATION, GX_FALSE, GX_TRUE);
4583 if (indentation != mpInfo->ewi.tree_view_indentation)
4584 {
4585 //tree view indentation is modified
4586 UndoManager()->AddEntry(UNDO_TYPE_TREE_VIEW_INFO, mpInfo);
4587 mpInfo->ewi.tree_view_indentation = indentation;
4588 gx_tree_view_indentation_set((GX_TREE_VIEW *)mpInfo->widget, indentation);
4589 GetProjectView()->CheckParentRefresh(mpInfo);
4590 return;
4591 }
4592
4593 ULONG style = mpInfo->style;
4594
4595 CButton *pb = (CButton *)GetDlgItem(ID_TREE_VIEW_SHOW_ROOT_LINES);
4596 if (pb)
4597 {
4598 if (pb->GetCheck() == BST_CHECKED)
4599 {
4600 style |= GX_STYLE_TREE_VIEW_SHOW_ROOT_LINES;
4601 }
4602 else
4603 {
4604 style &= ~GX_STYLE_TREE_VIEW_SHOW_ROOT_LINES;
4605 }
4606 }
4607
4608 if (style != mpInfo->style)
4609 {
4610 UndoManager()->AddEntry(UNDO_TYPE_STYLE, mpInfo);
4611 mpInfo->style = style;
4612 gx_widget_style_set(mpInfo->widget, style);
4613 mpProject->SetModified();
4614 return;
4615 }
4616
4617 CComboBox *pColorBox = (CComboBox *)GetDlgItem(ID_TREE_VIEW_ROOT_LINE_COLOR);
4618 if (pColorBox)
4619 {
4620 int box_index = pColorBox->GetCurSel();
4621 int ColorId = pColorBox->GetItemData(box_index);
4622
4623 widget_service_provider *provider = widget_factory::GetServiceProvider(mpInfo->basetype);
4624
4625 if ((ColorId != mpInfo->color_id[TREE_VIEW_ROOT_LINE_COLOR_INDEX]) && provider)
4626 {
4627 UndoManager()->AddEntry(UNDO_TYPE_COLOR, mpInfo, TREE_VIEW_ROOT_LINE_COLOR_INDEX);
4628 provider->AssignColor(mpInfo, TREE_VIEW_ROOT_LINE_COLOR_INDEX, ColorId);
4629 mpProject->SetModified();
4630 }
4631 }
4632 }
4633
4634 ///////////////////////////////////////////////////////////////////////////////
OnEditRichTextViewText()4635 void properties_win::OnEditRichTextViewText()
4636 {
4637 rich_text_view_service_provider *provider;
4638 provider = (rich_text_view_service_provider *)widget_factory::GetServiceProvider(mpInfo->basetype);
4639
4640 if (mpProject && mpInfo && provider && GetDlgItem(ID_RICH_TEXT_VIEW_TEXT_EDIT))
4641 {
4642 rich_text_edit_dlg dlg(mpInfo, this);
4643
4644 if (dlg.DoModal() == IDOK)
4645 {
4646 CString text = dlg.GetText();
4647
4648 GetDlgItem(ID_STRING_VAL)->SetWindowText(text);
4649 OnChangeStringText();
4650 }
4651
4652 GetDlgItem(ID_RICH_TEXT_VIEW_TEXT_EDIT)->SetFocus();
4653 }
4654 }
4655
4656 ///////////////////////////////////////////////////////////////////////////////
OnSettingChange(UINT uFlags,LPCTSTR lpszSection)4657 void properties_win::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
4658 {
4659 CDialog::OnSettingChange(uFlags, lpszSection);
4660
4661 SetControlSize();
4662 ResourcesChanged();
4663 }
4664
4665 ///////////////////////////////////////////////////////////////////////////////
OnTestMessage(WPARAM wParam,LPARAM lParam)4666 LRESULT properties_win::OnTestMessage(WPARAM wParam, LPARAM lParam)
4667 {
4668 CStringArray param_list;
4669 int ctrl_id;
4670 CString param2;
4671
4672 switch (wParam)
4673 {
4674 case TEST_EDIT_WIDGET_PROPS:
4675 case TEST_EDIT_WIDGET_PROPS_POST:
4676 if (wParam == TEST_EDIT_WIDGET_PROPS)
4677 {
4678 SplitString(GetTestingParam(0), ',', ¶m_list);
4679 }
4680 else
4681 {
4682 SplitString(GetTestingParam(1), ',', ¶m_list);
4683 }
4684
4685 if (param_list.GetCount() == 2)
4686 {
4687 ctrl_id = _tstoi(param_list.GetAt(0));
4688 param2 = param_list.GetAt(1);
4689
4690 CWnd *pWnd = GetDlgItem(ctrl_id);
4691
4692 if (!pWnd)
4693 {
4694 return 0;
4695 }
4696
4697 TCHAR class_name[MAX_PATH];
4698 GetClassName(pWnd->GetSafeHwnd(), class_name, MAX_PATH - 1);
4699
4700 switch (class_name[0])
4701 {
4702 case 'R':
4703 // "Rich Edit"
4704
4705 case 'E':
4706 //"Edit"
4707 ((CEdit *)pWnd)->SetWindowText(param2);
4708 SendMessage(WM_COMMAND, MAKEWPARAM(ctrl_id, EN_KILLFOCUS), (LPARAM)((CEdit *)pWnd)->m_hWnd);
4709 break;
4710 case 'C':
4711 //"ComboBox"
4712 ((CComboBox *)pWnd)->SelectString(-1, param2);
4713 SendMessage(WM_COMMAND, MAKEWPARAM(ctrl_id, CBN_SELCHANGE), (LPARAM)((CComboBox *)pWnd)->m_hWnd);
4714 break;
4715 case 'B':
4716 //"Button"
4717 ((CButton *)pWnd)->SetCheck(_tstoi(param2));
4718 SendMessage(WM_COMMAND, MAKEWPARAM(ctrl_id, BN_CLICKED), (LPARAM)((CButton *)pWnd)->m_hWnd);
4719 break;
4720 }
4721 }
4722 break;
4723
4724 default:
4725 break;
4726 }
4727 return 0;
4728 }
4729