@@ -292,74 +292,6 @@ namespace RTEGUI {
292
292
return (mousePosX >= xPos && mousePosX <= xPos + width && mousePosY >= yPos && mousePosY <= yPos + height) ? true : false ;
293
293
}
294
294
295
- // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
296
-
297
- void EditorApp::CalculateHandleResize (int mousePosX, int mousePosY, int *xPos, int *yPos, int *width, int *height) {
298
- int controlPosX;
299
- int controlPosY;
300
- int controlWidth;
301
- int controlHeight;
302
- m_SelectionInfo.Control ->GetControlRect (&controlPosX, &controlPosY, &controlWidth, &controlHeight);
303
- GUIControl *parent = m_SelectionInfo.Control ->GetParent ();
304
-
305
- int minSize = 5 ;
306
-
307
- int parentPosX;
308
- int parentPosY;
309
- int parentWidth;
310
- int parentHeight;
311
- parent->GetControlRect (&parentPosX, &parentPosY, &parentWidth, &parentHeight);
312
-
313
- // Left Move/Resize
314
- if (m_SelectionInfo.HandleIndex == 0 || m_SelectionInfo.HandleIndex == 3 || m_SelectionInfo.HandleIndex == 6 ) {
315
- int diff = mousePosX - m_SelectionInfo.GrabX ;
316
- if (controlPosX + diff < parentPosX) { diff = parentPosX - controlPosX; }
317
- if (controlWidth - diff < minSize) { diff = controlWidth - minSize; }
318
-
319
- diff = ProcessSnapCoord (diff);
320
-
321
- controlPosX += diff;
322
- controlWidth -= diff;
323
- }
324
- // Top Move/Resize
325
- if (m_SelectionInfo.HandleIndex == 0 || m_SelectionInfo.HandleIndex == 1 || m_SelectionInfo.HandleIndex == 2 ) {
326
- int diff = mousePosY - m_SelectionInfo.GrabY ;
327
- if (controlPosY + diff < parentPosY) { diff = parentPosY - controlPosY; }
328
- if (controlHeight - diff < minSize) { diff = controlHeight - minSize; }
329
-
330
- diff = ProcessSnapCoord (diff);
331
-
332
- controlPosY += diff;
333
- controlHeight -= diff;
334
- }
335
- // Right Resize
336
- if (m_SelectionInfo.HandleIndex == 2 || m_SelectionInfo.HandleIndex == 5 || m_SelectionInfo.HandleIndex == 8 ) {
337
- int diff = mousePosX - m_SelectionInfo.GrabX ;
338
- if (controlPosX + controlWidth + diff > parentPosX + parentWidth) { diff = (parentPosX + parentWidth) - (controlPosX + controlWidth); }
339
-
340
- diff = ProcessSnapCoord (diff);
341
-
342
- controlWidth += diff;
343
- }
344
- // Bottom Resize
345
- if (m_SelectionInfo.HandleIndex == 6 || m_SelectionInfo.HandleIndex == 7 || m_SelectionInfo.HandleIndex == 8 ) {
346
- int diff = mousePosY - m_SelectionInfo.GrabY ;
347
- if (controlPosY + controlHeight + diff > parentPosY + parentHeight) { diff = (parentPosY + parentHeight) - (controlPosY + controlHeight); }
348
-
349
- diff = ProcessSnapCoord (diff);
350
-
351
- controlHeight += diff;
352
- }
353
-
354
- controlWidth = std::max (controlWidth, minSize);
355
- controlHeight = std::max (controlHeight, minSize);
356
-
357
- *xPos = controlPosX;
358
- *yPos = controlPosY;
359
- *width = controlWidth;
360
- *height = controlHeight;
361
- }
362
-
363
295
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
364
296
365
297
int EditorApp::ProcessSnapCoord (int position) const {
@@ -696,52 +628,9 @@ namespace RTEGUI {
696
628
697
629
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
698
630
699
- void EditorApp::DrawSelectionBox (GUIControl *control) {
700
- assert (control);
701
-
702
- int mousePosX;
703
- int mousePosY;
704
- m_Input->GetMousePosition (&mousePosX, &mousePosY);
705
-
706
- int controlPosX;
707
- int controlPosY;
708
- int controlWidth;
709
- int controlHeight;
710
- control->GetControlRect (&controlPosX, &controlPosY, &controlWidth, &controlHeight);
711
-
712
- // If we've grabbed the control, draw the selection lines where the mouse is
713
- if (m_SelectionInfo.GrabbedControl && m_SelectionInfo.TriggerGrab ) {
714
- controlPosX = mousePosX + m_SelectionInfo.GrabX ;
715
- controlPosY = mousePosY + m_SelectionInfo.GrabY ;
716
-
717
- controlPosX = ProcessSnapCoord (controlPosX);
718
- controlPosY = ProcessSnapCoord (controlPosY);
719
631
}
720
632
721
- // Grabbed handles
722
- if (m_SelectionInfo.GrabbedHandle && m_SelectionInfo.TriggerGrab ) { CalculateHandleResize (mousePosX, mousePosY, &controlPosX, &controlPosY, &controlWidth, &controlHeight); }
723
-
724
- GUIRect rect;
725
- SetRect (&rect, controlPosX - 6 , controlPosY - 6 , controlPosX + controlWidth + 6 , controlPosY + controlHeight + 6 );
726
- m_Screen->GetBitmap ()->SetClipRect (&rect);
727
-
728
- m_Screen->GetBitmap ()->DrawRectangle (controlPosX, controlPosY, controlWidth, controlHeight, 0xFFCCCCCC , false );
729
-
730
- // Draw the handles
731
- for (int i = 0 ; i < 3 ; i++) {
732
- DrawSelectionResizeBox (controlPosX, controlPosY + i * (controlHeight / 2 ));
733
- if (i != 1 ) { DrawSelectionResizeBox (controlPosX + controlWidth / 2 , controlPosY + i * (controlHeight / 2 )); }
734
- DrawSelectionResizeBox (controlPosX + controlWidth, controlPosY + i * (controlHeight / 2 ));
735
- }
736
- m_Screen->GetBitmap ()->SetClipRect (nullptr );
737
- }
738
-
739
- // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
740
633
741
- void EditorApp::DrawSelectionResizeBox (int xPos, int yPos) const {
742
- int boxSize = (m_Zoom) ? 5 : 7 ;
743
- m_Screen->GetBitmap ()->DrawRectangle (xPos - boxSize / 2 , yPos - boxSize / 2 , boxSize, boxSize, 0x000000 , true );
744
- m_Screen->GetBitmap ()->DrawRectangle (xPos - boxSize / 2 , yPos - boxSize / 2 , boxSize, boxSize, 0xFFFFFF , false );
745
634
}
746
635
747
636
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0 commit comments