summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleo2005-10-02 02:18:05 +0000
committerleo2005-10-02 02:18:05 +0000
commit97727601bdc6d93d1576ea80a01b820cc34e3fb1 (patch)
tree6af826de935c47448a1f927a9094c791cde5e98d
parentaf794d98734dc8477c5aff9eb297479f01ba8ecc (diff)
Made Region Select part of regular selection.
git-svn-id: http://svn.leocad.org/trunk@424 c7d43263-9d01-0410-8a33-9dba5d9f93d6
-rw-r--r--common/project.cpp64
-rw-r--r--common/typedefs.h10
-rw-r--r--win/LeoCAD.rc2
-rw-r--r--win/System.cpp16
-rw-r--r--win/res/toolsbar.bmpbin2518 -> 2398 bytes
-rw-r--r--win/resource.h3
6 files changed, 62 insertions, 33 deletions
diff --git a/common/project.cpp b/common/project.cpp
index f8e339f..e5dc31f 100644
--- a/common/project.cpp
+++ b/common/project.cpp
@@ -2401,7 +2401,7 @@ void Project::RenderScene(bool bShaded, bool bDrawViewports)
}
// Draw the selection rectangle.
- if ((m_nCurAction == LC_ACTION_SELECT_REGION) && (m_nTracking == LC_TRACK_LEFT))
+ if ((m_nCurAction == LC_ACTION_SELECT) && (m_nTracking == LC_TRACK_LEFT))
{
int x, y, w, h;
@@ -6901,40 +6901,44 @@ bool Project::StopTracking(bool bAccept)
{
switch (m_nCurAction)
{
- case LC_ACTION_SELECT_REGION:
+ case LC_ACTION_SELECT:
{
- // Find objects inside the rectangle.
- PtrArray<Object> Objects;
- FindObjectsInBox((float)m_nDownX, (float)m_nDownY, m_fTrack[0], m_fTrack[1], Objects);
+ if (((float)m_nDownX != m_fTrack[0]) || ((float)m_nDownY != m_fTrack[1]))
+ {
+ // Find objects inside the rectangle.
+ PtrArray<Object> Objects;
+ FindObjectsInBox((float)m_nDownX, (float)m_nDownY, m_fTrack[0], m_fTrack[1], Objects);
- // Deselect old pieces.
- bool Control = Sys_KeyDown(KEY_CONTROL);
- SelectAndFocusNone(Control);
+ // Deselect old pieces.
+ bool Control = Sys_KeyDown(KEY_CONTROL);
+ SelectAndFocusNone(Control);
- // Select new pieces.
- for (int i = 0; i < Objects.GetSize(); i++)
- {
- if (Objects[i]->GetType() == LC_OBJECT_PIECE)
+ // Select new pieces.
+ for (int i = 0; i < Objects.GetSize(); i++)
{
- Group* pGroup = ((Piece*)Objects[i])->GetTopGroup();
- if (pGroup != NULL)
+ if (Objects[i]->GetType() == LC_OBJECT_PIECE)
{
- for (Piece* pPiece = m_pPieces; pPiece; pPiece = pPiece->m_pNext)
- if ((pPiece->IsVisible(m_bAnimation ? m_nCurFrame : m_nCurStep, m_bAnimation)) &&
- (pPiece->GetTopGroup() == pGroup))
- pPiece->Select (true, false, false);
+ Group* pGroup = ((Piece*)Objects[i])->GetTopGroup();
+ if (pGroup != NULL)
+ {
+ for (Piece* pPiece = m_pPieces; pPiece; pPiece = pPiece->m_pNext)
+ if ((pPiece->IsVisible(m_bAnimation ? m_nCurFrame : m_nCurStep, m_bAnimation)) &&
+ (pPiece->GetTopGroup() == pGroup))
+ pPiece->Select (true, false, false);
+ }
+ else
+ Objects[i]->Select(true, false, Control);
}
else
Objects[i]->Select(true, false, Control);
}
- else
- Objects[i]->Select(true, false, Control);
+
+ // Update screen and UI.
+ UpdateSelection();
+ UpdateAllViews();
+ SystemUpdateFocus(NULL);
}
- // Update screen and UI.
- UpdateSelection();
- UpdateAllViews();
- SystemUpdateFocus(NULL);
} break;
case LC_ACTION_MOVE:
@@ -6980,7 +6984,6 @@ bool Project::StopTracking(bool bAccept)
UpdateAllViews();
} break;
- case LC_ACTION_SELECT:
case LC_ACTION_INSERT:
case LC_ACTION_LIGHT:
case LC_ACTION_ERASER:
@@ -6991,7 +6994,11 @@ bool Project::StopTracking(bool bAccept)
}
else if (m_pTrackFile != NULL)
{
- if (m_nCurAction != LC_ACTION_SELECT_REGION)
+ if (m_nCurAction == LC_ACTION_SELECT)
+ {
+ UpdateAllViews();
+ }
+ else
{
DeleteContents (true);
FileLoad (m_pTrackFile, true, false);
@@ -7796,6 +7803,8 @@ void Project::OnLeftButtonDown(int x, int y, bool bControl, bool bShift)
UpdateSelection();
UpdateAllViews();
SystemUpdateFocus(ClickLine.pClosest);
+
+ StartTracking(LC_TRACK_START_LEFT);
}
if ((m_nCurAction == LC_ACTION_ERASER) && (ClickLine.pClosest != NULL))
@@ -8028,7 +8037,6 @@ void Project::OnLeftButtonDown(int x, int y, bool bControl, bool bShift)
}
} break;
- case LC_ACTION_SELECT_REGION:
case LC_ACTION_ZOOM:
case LC_ACTION_ROLL:
case LC_ACTION_PAN:
@@ -8229,7 +8237,7 @@ void Project::OnMouseMove(int x, int y, bool bControl, bool bShift)
switch (m_nCurAction)
{
- case LC_ACTION_SELECT_REGION:
+ case LC_ACTION_SELECT:
{
int ptx = x, pty = y;
diff --git a/common/typedefs.h b/common/typedefs.h
index e3c1309..754bbae 100644
--- a/common/typedefs.h
+++ b/common/typedefs.h
@@ -7,7 +7,9 @@
class Group;
class Piece;
class PieceInfo;
+
#include "defines.h"
+#include "str.h"
typedef enum
{
@@ -142,7 +144,6 @@ typedef enum
typedef enum
{
LC_ACTION_SELECT,
- LC_ACTION_SELECT_REGION,
LC_ACTION_INSERT,
LC_ACTION_LIGHT,
LC_ACTION_SPOTLIGHT,
@@ -278,6 +279,7 @@ typedef enum {
LC_DLG_STEPCHOOSE,
LC_DLG_EDITGROUPS,
LC_DLG_GROUP,
+ LC_DLG_EDITCATEGORY,
LC_DLG_ABOUT
} LC_DIALOGS;
@@ -374,4 +376,10 @@ typedef struct
char strHeader[256];
} LC_PREFERENCESDLG_OPTS;
+typedef struct
+{
+ String Name;
+ String Keywords;
+} LC_CATEGORYDLG_OPTS;
+
#endif
diff --git a/win/LeoCAD.rc b/win/LeoCAD.rc
index 7438ce5..1be254e 100644
--- a/win/LeoCAD.rc
+++ b/win/LeoCAD.rc
@@ -143,7 +143,6 @@ BEGIN
BUTTON ID_ACTION_CAMERA
SEPARATOR
BUTTON ID_ACTION_SELECT
- BUTTON ID_ACTION_SELECT_REGION
BUTTON ID_ACTION_MOVE
BUTTON ID_ACTION_ROTATE
BUTTON ID_ACTION_REMOVE
@@ -2053,7 +2052,6 @@ END
STRINGTABLE DISCARDABLE
BEGIN
ID_ACTION_SELECT "Select objects with the mouse\nSelect"
- ID_ACTION_SELECT_REGION "Select objects with the mouse\nSelect Region"
ID_ACTION_INSERT "Add pieces to the project\nInsert"
ID_ACTION_LIGHT "Add a positional light source\nPositional Light"
ID_ACTION_SPOTLIGHT "Add a spotlight\nSpotlight"
diff --git a/win/System.cpp b/win/System.cpp
index 6406017..2c29db4 100644
--- a/win/System.cpp
+++ b/win/System.cpp
@@ -27,6 +27,7 @@
#include "LibDlg.h"
#include "EdGrpDlg.h"
#include "AboutDlg.h"
+#include "categdlg.h"
#include "cadbar.h"
#include "mainfrm.h"
@@ -1528,6 +1529,21 @@ bool SystemDoDialog(int nMode, void* param)
}
} break;
+ case LC_DLG_EDITCATEGORY:
+ {
+ CCategoryDlg Dlg;
+ LC_CATEGORYDLG_OPTS* Opts = (LC_CATEGORYDLG_OPTS*)param;
+
+ Dlg.m_Keywords = Opts->Keywords;
+ Dlg.m_Name = Opts->Name;
+
+ if (Dlg.DoModal() == IDOK)
+ {
+ Opts->Keywords = Dlg.m_Keywords;
+ Opts->Name = Dlg.m_Name;
+ }
+ } break;
+
case LC_DLG_ABOUT:
{
CAboutDlg dlg;
diff --git a/win/res/toolsbar.bmp b/win/res/toolsbar.bmp
index 721346d..84ad134 100644
--- a/win/res/toolsbar.bmp
+++ b/win/res/toolsbar.bmp
Binary files differ
diff --git a/win/resource.h b/win/resource.h
index f32e81e..19f4f51 100644
--- a/win/resource.h
+++ b/win/resource.h
@@ -458,8 +458,7 @@
#define ID_VIEW_STEP_PREVIOUS 32783
#define ID_VIEW_STEP_CHOOSE 32784
#define ID_VIEW_STEP_INSERT 32785
-#define ID_ACTION_SELECT 32788
-#define ID_ACTION_SELECT_REGION 32789
+#define ID_ACTION_SELECT 32789
#define ID_ACTION_INSERT 32790
#define ID_ACTION_LIGHT 32791
#define ID_ACTION_SPOTLIGHT 32792