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
4a39fcdd
Commit
4a39fcdd
authored
Mar 21, 2014
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
single_top.c logic, improved OpenProjectFiles() documentation.
parent
8fc1e382
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
57 deletions
+41
-57
single_top.cpp
common/single_top.cpp
+32
-55
kiway_player.h
include/kiway_player.h
+9
-2
No files found.
common/single_top.cpp
View file @
4a39fcdd
...
@@ -353,76 +353,54 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
...
@@ -353,76 +353,54 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
if
(
argc
>
1
)
if
(
argc
>
1
)
{
{
/*
gerbview handles multiple project data files, i.e. gerber files on
cmd line. Others currently do not, they handle only one. For common
code simplicity we simply pass all the arguments in however, each
program module can do with them what they want, ignore, complain
whatever. We don't establish policy here, as this is a multi-purpose
launcher.
*/
#if defined(TOP_FRAME) && TOP_FRAME==GERBER_FRAME_TYPE
std
::
vector
<
wxString
>
argSet
;
// gerbview handles multiple project data files, i.e. gerber files on cmd line.
std
::
vector
<
wxString
>
fileSet
;
// Load all files specified on the command line.
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
{
wxFileName
fn
(
App
().
argv
[
i
]
);
argSet
.
push_back
(
App
().
argv
[
i
]
);
if
(
fn
.
FileExists
()
)
fileSet
.
push_back
(
App
().
argv
[
i
]
);
}
wxFileName
fn
(
fileSet
[
0
]
);
if
(
fn
.
GetPath
().
size
()
)
{
// wxSetWorkingDirectory does not like empty paths
wxSetWorkingDirectory
(
fn
.
GetPath
()
);
// @todo: setting CWD is taboo in a multi-project environment
}
// Use the KIWAY_PLAYER::OpenProjectFiles() API function:
if
(
!
frame
->
OpenProjectFiles
(
fileSet
)
)
{
// OpenProjectFiles() API asks that it report failure to the UI.
// Nothing further to say here.
// Fail the process startup if the file could not be opened,
// although this is an optional choice, one that can be reversed
// also in the KIFACE specific OpenProjectFiles() return value.
return
false
;
}
}
#else
// special attention to the first argument: argv[1] (==argSet[0])
wxFileName
argv1
(
argSet
[
0
]
);
wxFileName
fn
(
argv
[
1
]
);
if
(
!
fn
.
IsOk
()
)
if
(
argc
==
2
)
{
{
return
false
;
}
#if defined(PGM_DATA_FILE_EXT)
#if defined(PGM_DATA_FILE_EXT)
// PGM_DATA_FILE_EXT is different for each compile, it may come from CMake
// PGM_DATA_FILE_EXT is different for each compile, it may come
// on the compiler command line, or not.
// from CMake on the compiler command line, often does not.
if
(
!
fn
.
GetExt
()
)
// This facillity is mostly useful only for those program modules
fn
.
SetExt
(
wxT
(
PGM_DATA_FILE_EXT
)
);
// supporting a single argv[1].
if
(
!
argv1
.
GetExt
()
)
argv1
.
SetExt
(
wxT
(
PGM_DATA_FILE_EXT
)
);
argSet
[
0
]
=
argv1
.
GetFullPath
();
#endif
#endif
if
(
!
Pgm
().
LockFile
(
argSet
[
0
]
)
)
if
(
!
Pgm
().
LockFile
(
fn
.
GetFullPath
()
)
)
{
{
wxLogSysError
(
_
(
"This file is already open."
)
);
wxLogSysError
(
_
(
"This file is already open."
)
)
;
return
false
;
return
false
;
}
}
}
if
(
fn
.
GetPath
().
size
()
)
// @todo: setting CWD is taboo in a multi-project environment, this
// will not be possible soon.
if
(
argv1
.
GetPath
().
size
()
)
// path only
{
{
// wxSetWorkingDirectory does not like empty paths
// wxSetWorkingDirectory() does not like empty paths
wxSetWorkingDirectory
(
fn
.
GetPath
()
);
wxSetWorkingDirectory
(
argv1
.
GetPath
()
);
// @todo: setting CWD is taboo in a multi-project environment
}
}
// Use the KIWAY_PLAYER::OpenProjectFiles() API function:
// Use the KIWAY_PLAYER::OpenProjectFiles() API function:
if
(
!
frame
->
OpenProjectFiles
(
std
::
vector
<
wxString
>
(
1
,
fn
.
GetFullPath
()
)
)
)
if
(
!
frame
->
OpenProjectFiles
(
argSet
)
)
{
{
// OpenProjectFiles() API asks that it report failure to the UI.
// OpenProjectFiles() API asks that it report failure to the UI.
// Nothing further to say here.
// Nothing further to say here.
...
@@ -432,7 +410,6 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
...
@@ -432,7 +410,6 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
// also in the KIFACE specific OpenProjectFiles() return value.
// also in the KIFACE specific OpenProjectFiles() return value.
return
false
;
return
false
;
}
}
#endif
}
}
else
else
{
{
...
...
include/kiway_player.h
View file @
4a39fcdd
...
@@ -129,8 +129,15 @@ public:
...
@@ -129,8 +129,15 @@ public:
* KIWAY_PLAYER is precluded.
* KIWAY_PLAYER is precluded.
* <p>
* <p>
* Each derived class should handle this in a way specific to its needs.
* Each derived class should handle this in a way specific to its needs.
* No prompting is done inside here for any file or project. There is no
* No prompting is done inside here for any file or project. There should be
* need to call this with aFileList which is empty.
* need to call this with aFileList which is empty. However, calling it with
* a single filename which does not exist should indicate to the implementor
* that a new session is being started and that the given name is the desired
* name for the data file at time of save.
* <p>
* Therefore, one of the first things an implementation should do is test for
* existence of the first file in the list, and if it does not exist, treat
* it as a new session, possibly with a UI notification to that effect.
* <p>
* <p>
* After loading the window should update its Title as part of this operation.
* After loading the window should update its Title as part of this operation.
* If the KIWAY_PLAYER needs to, it can load the *.pro file as part of this operation.
* If the KIWAY_PLAYER needs to, it can load the *.pro file as part of this operation.
...
...
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