Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
7dbcbf6d
Commit
7dbcbf6d
authored
Jan 03, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Kicad manager: cleanup code, remove dead or not working code. Fix minor isssues
parent
7ae228d7
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
315 deletions
+100
-315
viewlib_frame.cpp
eeschema/viewlib_frame.cpp
+0
-1
class_treeproject_item.cpp
kicad/class_treeproject_item.cpp
+4
-85
class_treeproject_item.h
kicad/class_treeproject_item.h
+5
-8
tree_project_frame.cpp
kicad/tree_project_frame.cpp
+78
-213
tree_project_frame.h
kicad/tree_project_frame.h
+13
-8
No files found.
eeschema/viewlib_frame.cpp
View file @
7dbcbf6d
...
...
@@ -34,7 +34,6 @@
#include <wxEeschemaStruct.h>
#include <general.h>
//#include <protos.h>
#include <viewlib_frame.h>
#include <class_library.h>
#include <hotkeys.h>
...
...
kicad/class_treeproject_item.cpp
View file @
7dbcbf6d
...
...
@@ -77,94 +77,11 @@ wxString TREEPROJECT_ITEM::GetDir() const
wxFileName
filename
=
wxFileName
(
m_FileName
);
filename
.
MakeRelativeTo
(
wxGetCwd
()
);
wxArrayString
dirs
=
filename
.
GetDirs
();
wxString
dir
;
for
(
unsigned
int
i
=
0
;
i
<
dirs
.
Count
();
i
++
)
{
dir
+=
dirs
[
i
]
+
filename
.
GetPathSeparator
();
}
wxString
dir
=
filename
.
GetPath
();
return
dir
;
}
// Move the object to dest
void
TREEPROJECT_ITEM
::
Move
(
TREEPROJECT_ITEM
*
dest
)
{
// function not safe.
return
;
const
wxString
sep
=
wxFileName
().
GetPathSeparator
();
if
(
m_Type
==
TREE_DIRECTORY
)
return
;
if
(
!
dest
)
return
;
if
(
m_parent
!=
dest
->
m_parent
)
return
;
// Can not cross move!
if
(
dest
==
this
)
return
;
// Can not move to ourself...
wxTreeItemId
parent
=
m_parent
->
GetItemParent
(
GetId
()
);
if
(
dest
==
dynamic_cast
<
TREEPROJECT_ITEM
*>
(
m_parent
->
GetItemData
(
parent
)
)
)
return
;
// same parent ?
// We need to create a new item from us, and move
// data to there ...
// First move file on the disk
wxFileName
fname
(
m_FileName
);
wxString
destName
;
if
(
!
dest
->
GetDir
().
IsEmpty
()
)
destName
=
dest
->
GetDir
()
+
sep
;
destName
+=
fname
.
GetFullName
();
if
(
destName
==
GetFileName
()
)
return
;
// Same place ??
// Move the file on the disk:
if
(
!
wxRenameFile
(
GetFileName
(),
destName
,
false
)
)
{
wxMessageDialog
(
m_parent
,
_
(
"Unable to move file ... "
),
_
(
"Permission error ?"
),
wxICON_ERROR
|
wxOK
);
return
;
}
SetFileName
(
destName
);
if
(
TREE_DIRECTORY
!=
GetType
()
)
{
// Move the tree item itself now:
wxTreeItemId
oldId
=
GetId
();
int
i
=
m_parent
->
GetItemImage
(
oldId
);
wxString
text
=
m_parent
->
GetItemText
(
oldId
);
// Bye bye old Id :'(
wxTreeItemId
newId
=
m_parent
->
AppendItem
(
dest
->
GetId
(),
text
,
i
);
m_parent
->
SetItemData
(
newId
,
this
);
m_parent
->
SetItemData
(
oldId
,
NULL
);
m_parent
->
Delete
(
oldId
);
}
else
{
// We should move recursively all files, but that's quite boring
// let's just refresh that's all ... TODO (change this to a better code ...)
wxCommandEvent
dummy
;
dynamic_cast
<
TREEPROJECTFILES
*>
(
m_parent
)
->
GetParent
()
->
m_Parent
->
OnRefresh
(
dummy
);
}
}
/* rename the file checking if extension change occurs */
bool
TREEPROJECT_ITEM
::
Rename
(
const
wxString
&
name
,
bool
check
)
{
...
...
@@ -218,7 +135,9 @@ type.\n Do you want to continue ?"
return
false
;
}
#ifndef KICAD_USE_FILES_WATCHER
SetFileName
(
newFile
);
#endif
return
true
;
}
...
...
@@ -263,7 +182,7 @@ bool TREEPROJECT_ITEM::Delete( bool check )
}
/
* Called under item activation */
/
/ Called under item activation
void
TREEPROJECT_ITEM
::
Activate
(
TREE_PROJECT_FRAME
*
prjframe
)
{
wxString
sep
=
wxFileName
().
GetPathSeparator
();
...
...
kicad/class_treeproject_item.h
View file @
7dbcbf6d
...
...
@@ -15,7 +15,6 @@ public:
bool
m_WasPopulated
;
// True the name is a directory, and its content was read
private
:
wxTreeCtrl
*
m_parent
;
wxMenu
m_fileMenu
;
int
m_state
;
public
:
...
...
@@ -50,17 +49,15 @@ public:
m_FileName
=
name
;
}
/**
* @return the path of an item.
* if this item is a directory, returns the stored filename
* if this is a file, returns its path
*/
wxString
GetDir
()
const
;
bool
Rename
(
const
wxString
&
name
,
bool
check
=
true
);
bool
Delete
(
bool
check
=
true
);
void
Move
(
TREEPROJECT_ITEM
*
dest
);
void
Activate
(
TREE_PROJECT_FRAME
*
prjframe
);
const
wxMenu
*
GetMenu
()
{
return
&
m_fileMenu
;
}
void
SetState
(
int
state
);
};
kicad/tree_project_frame.cpp
View file @
7dbcbf6d
This diff is collapsed.
Click to expand it.
kicad/tree_project_frame.h
View file @
7dbcbf6d
...
...
@@ -46,13 +46,10 @@ class TREE_PROJECT_FRAME : public wxSashLayoutWindow
public
:
KICAD_MANAGER_FRAME
*
m_Parent
;
TREEPROJECTFILES
*
m_TreeProject
;
wxTreeItemId
m_root
;
private
:
std
::
vector
<
wxMenu
*>
m_ContextMenus
;
wxTreeItemId
m_root
;
std
::
vector
<
wxString
>
m_filters
;
wxMenu
*
m_PopupMenu
;
wxCursor
m_DragCursor
;
wxCursor
m_Default
;
#ifdef KICAD_USE_FILES_WATCHER
wxFileSystemWatcher
*
m_watcher
;
// file system watcher (since wxWidgets 2.9.2)
...
...
@@ -73,7 +70,6 @@ public:
#endif
protected
:
wxMenu
*
GetContextMenu
(
int
type
);
static
wxString
GetFileExt
(
TreeFileType
type
);
static
wxString
GetFileWildcard
(
TreeFileType
type
);
...
...
@@ -94,10 +90,19 @@ protected:
TREEPROJECT_ITEM
*
GetItemIdData
(
wxTreeItemId
aId
);
private
:
/**
* Called on a double click on an item
*/
void
OnSelect
(
wxTreeEvent
&
Event
);
/**
* Called on a click on the + or - button of an item with children
*/
void
OnExpand
(
wxTreeEvent
&
Event
);
void
OnDragStart
(
wxTreeEvent
&
event
);
void
OnDragEnd
(
wxTreeEvent
&
event
);
/**
* Called on a right click on an item
*/
void
OnRight
(
wxTreeEvent
&
Event
);
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment