summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleo2006-02-12 00:16:08 +0000
committerleo2006-02-12 00:16:08 +0000
commit5fd519ca2dd1d026929a82164246f515013552fe (patch)
treeed625df189bee3a24ddb4786ad5198dbffca4bd7
parent6ccbb0b27366b263042770d481a508dbe7335e34 (diff)
Removed old PieceInfo group code.
git-svn-id: http://svn.leocad.org/trunk@471 c7d43263-9d01-0410-8a33-9dba5d9f93d6
-rw-r--r--common/pieceinf.cpp2
-rw-r--r--common/pieceinf.h1
-rw-r--r--linux/toolbar.cpp77
-rw-r--r--win/Leocad.cpp73
4 files changed, 40 insertions, 113 deletions
diff --git a/common/pieceinf.cpp b/common/pieceinf.cpp
index 56cf7c3..ffb1a76 100644
--- a/common/pieceinf.cpp
+++ b/common/pieceinf.cpp
@@ -223,7 +223,7 @@ void PieceInfo::LoadIndex (File& file)
m_strDescription[64] = '\0';
file.ReadShort (sh, 6);
file.ReadByte (&m_nFlags, 1);
- file.ReadLong (&m_nGroups, 1);
+ lcuint32 Groups; file.ReadLong (&Groups, 1);
file.ReadLong (&m_nOffset, 1);
file.ReadLong (&m_nSize, 1);
diff --git a/common/pieceinf.h b/common/pieceinf.h
index 9dd3d94..7676700 100644
--- a/common/pieceinf.h
+++ b/common/pieceinf.h
@@ -98,7 +98,6 @@ public:
float m_fDimensions[6];
unsigned long m_nOffset;
unsigned long m_nSize;
- unsigned long m_nGroups;
// Nobody should change these
unsigned char m_nFlags;
diff --git a/linux/toolbar.cpp b/linux/toolbar.cpp
index daabd55..59b33f6 100644
--- a/linux/toolbar.cpp
+++ b/linux/toolbar.cpp
@@ -252,8 +252,6 @@ void create_toolbars(GtkWidget *window, GtkWidget *vbox)
// Pieces toolbar
static bool list_subparts = false;
-static bool list_groups = true;
-static int list_curgroup;
static int piecelist_col_sort = 0;
static bool piecelist_ascending = true;
static int cur_color = 0;
@@ -290,7 +288,7 @@ static void fill_piecelist(int group)
gtk_clist_freeze(GTK_CLIST(piecelist));
gtk_clist_clear(GTK_CLIST(piecelist));
- list_curgroup = group;
+// list_curgroup = group;
for (int i = 0; i < pLib->GetPieceCount (); i++)
{
@@ -299,7 +297,7 @@ static void fill_piecelist(int group)
if ((pInfo->m_strDescription[0] == '~') && !list_subparts)
continue;
- if ((!list_groups) || ((pInfo->m_nGroups & (long)(1 << group)) != 0))
+// if ((!list_groups) || ((pInfo->m_nGroups & (long)(1 << group)) != 0))
{
char* dummy[] = { pInfo->m_strDescription, pInfo->m_strName };
@@ -401,44 +399,47 @@ void piececombo_add (const char* str)
static void piececombo_changed (GtkWidget *widget, gpointer data)
{
- PiecesLibrary *pLib = project->GetPiecesLibrary ();
- const gchar* str;
- int i;
+ PiecesLibrary *pLib = project->GetPiecesLibrary ();
+ const gchar* str;
+ int i;
- str = gtk_entry_get_text (GTK_ENTRY (pieceentry));
+ str = gtk_entry_get_text (GTK_ENTRY (pieceentry));
- for (i = 0; i < pLib->GetPieceCount (); i++)
- {
- PieceInfo* pInfo = pLib->GetPieceInfo (i);
-
- if (strcmp (str, pInfo->m_strDescription) == 0)
- {
- // Check if we need to change the current group
- if ((list_groups) && (pInfo->m_nGroups != 0))
- if ((pInfo->m_nGroups & (1 << list_curgroup)) == 0)
+ for (i = 0; i < pLib->GetPieceCount (); i++)
{
- unsigned long d = 1;
- for (int k = 1; k < 32; k++)
- {
- if ((pInfo->m_nGroups & d) != 0)
- {
- groupsbar_set (k-1);
- break;
- }
- else
- d <<= 1;
- }
+ PieceInfo* pInfo = pLib->GetPieceInfo (i);
+
+ if (strcmp (str, pInfo->m_strDescription) == 0)
+ {
+/*
+ // Check if we need to change the current group
+ if ((list_groups) && (pInfo->m_nGroups != 0))
+ {
+ if ((pInfo->m_nGroups & (1 << list_curgroup)) == 0)
+ {
+ unsigned long d = 1;
+ for (int k = 1; k < 32; k++)
+ {
+ if ((pInfo->m_nGroups & d) != 0)
+ {
+ groupsbar_set (k-1);
+ break;
+ }
+ else
+ d <<= 1;
+ }
+ }
+ }
+*/
+ // Select the piece
+ i = gtk_clist_find_row_from_data (GTK_CLIST (piecelist), pInfo);
+ gtk_clist_select_row (GTK_CLIST (piecelist), i, 0);
+ if (gtk_clist_row_is_visible (GTK_CLIST (piecelist), i) != GTK_VISIBILITY_FULL)
+ gtk_clist_moveto (GTK_CLIST (piecelist), i, 0, 0.5f, 0);
+
+ return;
+ }
}
-
- // Select the piece
- i = gtk_clist_find_row_from_data (GTK_CLIST (piecelist), pInfo);
- gtk_clist_select_row (GTK_CLIST (piecelist), i, 0);
- if (gtk_clist_row_is_visible (GTK_CLIST (piecelist), i) != GTK_VISIBILITY_FULL)
- gtk_clist_moveto (GTK_CLIST (piecelist), i, 0, 0.5f, 0);
-
- return;
- }
- }
}
// Draw a pixmap for the colorlist control
diff --git a/win/Leocad.cpp b/win/Leocad.cpp
index 6dbcce1..fb409bd 100644
--- a/win/Leocad.cpp
+++ b/win/Leocad.cpp
@@ -218,79 +218,6 @@ BOOL CCADApp::InitInstance()
((CMainFrame*)(AfxGetMainWnd()))->m_wndPiecesBar.m_wndPiecePreview.PostMessage(WM_PAINT);
}
- // TODO: move this to the project.
- CString cfg = GetProfileString("Settings","Groups","");
- if (!cfg.IsEmpty())
- {
- UINT j, i;
- CWaitCursor wait;
- CFile f;
- if (f.Open(cfg, CFile::modeRead|CFile::shareDenyWrite) != 0)
- if (f.GetLength() != 0)
- {
- CArchive ar(&f, CArchive::load | CArchive::bNoFlushOnDelete);
- char tmp[33];
- float ver;
- CString str;
- UINT n;
- ar.Read (tmp, 32);
- ar >> ver;
- if (ver == 0.1f)
- ar >> i;
- else
- {
- BYTE b;
- ar >> b;
- for (j = 0; j < b; j++)
- {
- ar.Read (tmp, 33);
-
- if (ver > 0.2f)
- ar >> i;
- }
- }
- if (ver > 0.2f)
- {
- CImageList iml;
- iml.Read(&ar);
- }
-
- ar >> n;
- for (i = 0; i < n; i++)
- {
- DWORD dw;
- char name[9];
- ar.Read (name, 9);
-
- if (ver == 0.1f)
- {
- char tmp[65];
- BYTE b;
- ar.Read (tmp, 65);
- ar >> b;
- dw = 1 << b;
- }
- else
- ar >> dw;
-
- PiecesLibrary *pLib = project->GetPiecesLibrary ();
- for (int j = 0; j < pLib->GetPieceCount (); j++)
- {
- PieceInfo* pInfo = pLib->GetPieceInfo (j);
-
- if (strcmp (pInfo->m_strName, name) == 0)
- {
- pInfo->m_nGroups = dw;
- break;
- }
- }
- }
- ar.Close();
- f.Close();
- }
- }
-
-
/*
m_hMutex = CreateMutex(NULL, FALSE, _T("LeoCAD_Mutex"));
if (GetLastError() == ERROR_ALREADY_EXISTS)