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
Show 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 )
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
// 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.
std
::
vector
<
wxString
>
argSet
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
wxFileName
fn
(
App
().
argv
[
i
]
);
if
(
fn
.
FileExists
()
)
fileSet
.
push_back
(
App
().
argv
[
i
]
);
argSet
.
push_back
(
App
().
argv
[
i
]
);
}
wxFileName
fn
(
fileSet
[
0
]
);
// special attention to the first argument: argv[1] (==argSet[0])
wxFileName
argv1
(
argSet
[
0
]
);
if
(
fn
.
GetPath
().
size
()
)
if
(
argc
==
2
)
{
// 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
wxFileName
fn
(
argv
[
1
]
);
if
(
!
fn
.
IsOk
()
)
{
return
false
;
}
#if defined(PGM_DATA_FILE_EXT)
// PGM_DATA_FILE_EXT is different for each compile, it may come from CMake
// on the compiler command line, or not.
if
(
!
fn
.
GetExt
()
)
fn
.
SetExt
(
wxT
(
PGM_DATA_FILE_EXT
)
);
// PGM_DATA_FILE_EXT is different for each compile, it may come
// from CMake on the compiler command line, often does not.
// This facillity is mostly useful only for those program modules
// supporting a single argv[1].
if
(
!
argv1
.
GetExt
()
)
argv1
.
SetExt
(
wxT
(
PGM_DATA_FILE_EXT
)
);
argSet
[
0
]
=
argv1
.
GetFullPath
();
#endif
if
(
!
Pgm
().
LockFile
(
fn
.
GetFullPath
()
)
)
if
(
!
Pgm
().
LockFile
(
argSet
[
0
]
)
)
{
wxLogSysError
(
_
(
"This file is already open."
)
);
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
(
fn
.
GetPath
()
);
// @todo: setting CWD is taboo in a multi-project environment
// wxSetWorkingDirectory() does not like empty paths
wxSetWorkingDirectory
(
argv1
.
GetPath
()
);
}
// 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.
// Nothing further to say here.
...
...
@@ -432,7 +410,6 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
// also in the KIFACE specific OpenProjectFiles() return value.
return
false
;
}
#endif
}
else
{
...
...
include/kiway_player.h
View file @
4a39fcdd
...
...
@@ -129,8 +129,15 @@ public:
* KIWAY_PLAYER is precluded.
* <p>
* 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
* need to call this with aFileList which is empty.
* No prompting is done inside here for any file or project. There should be
* 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>
* 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.
...
...
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