mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-13 14:13:02 +00:00
Compare commits
557 commits
projectcen
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
b7fcad40f8 | ||
|
1b7cc44ff1 | ||
|
6c0063600d | ||
|
4405dcc8c4 | ||
|
de5e8f63c5 | ||
|
63af855c24 | ||
|
5964418bb1 | ||
|
ac3fad4b6f | ||
|
05e4b859be | ||
|
f5bdb40882 | ||
|
7ce2cd367a | ||
|
fdebc6367f | ||
|
fc194db093 | ||
|
c37b1dbe05 | ||
|
79150d285b | ||
|
5932086c64 | ||
|
cdfebcedba | ||
|
7f100b4ecd | ||
|
cc48c443fa | ||
|
5244eb1037 | ||
|
aeeaf4c3ab | ||
|
8c3ebba096 | ||
|
beb93d83e3 | ||
|
7e64e50cda | ||
|
2c1c01f807 | ||
|
52539893eb | ||
|
522edc8cf6 | ||
|
0d75eae5d0 | ||
|
d63d77b98e | ||
|
377359a92f | ||
|
cf1b7a3215 | ||
|
c8c3b2fc0e | ||
|
008b192d99 | ||
|
c0f24a756f | ||
|
0b8ae1f554 | ||
|
4216c13cda | ||
|
01a3a61b2e | ||
|
a0856faf21 | ||
|
1749847eac | ||
|
8ab1b66eb5 | ||
|
d6a2ce3650 | ||
|
60db8c598f | ||
|
49a778a8ad | ||
|
ae35ca4c10 | ||
|
61eff93341 | ||
|
5b988495cc | ||
|
aaaea5965b | ||
|
07c911b995 | ||
|
aff171ceff | ||
|
bae62a963b | ||
|
bedce090f9 | ||
|
aa76e6406c | ||
|
b701d1a40b | ||
|
b3fa5f1949 | ||
|
d49d4d6e5f | ||
|
77972b4abb | ||
|
994aff232c | ||
|
0b9e2ddb8d | ||
|
538016b372 | ||
|
82d4d12f82 | ||
|
0bce146347 | ||
|
ffcf6cfff6 | ||
|
c0742c88a3 | ||
|
af4e9fffe4 | ||
|
0f6ce6ba95 | ||
|
aed50386f7 | ||
|
6c59f53df4 | ||
|
7504a154e1 | ||
|
f9633b2db6 | ||
|
18136e7678 | ||
|
f9d8e56a2e | ||
|
736093b0c1 | ||
|
87988f435c | ||
|
56d789e232 | ||
|
991b7fba21 | ||
|
25f423bebd | ||
|
dd9a827b30 | ||
|
56f5d087b9 | ||
|
7dedd5871f | ||
|
7c30ee1f38 | ||
|
b7cfa30f20 | ||
|
f68e83ad6f | ||
|
c567c110a3 | ||
|
725da9e9c8 | ||
|
4d19c42454 | ||
|
822e7f0d3a | ||
|
08cd658b6d | ||
|
b3a968b8a3 | ||
|
dd1c1e75ba | ||
|
ec805871c3 | ||
|
b1533c4a02 | ||
|
81e6f3b82a | ||
|
7adfa56357 | ||
|
67381ab3cc | ||
|
a26fbaa6c1 | ||
|
cd0c4972a3 | ||
|
c0fd3f8df7 | ||
|
8970a0617d | ||
|
079467ccc1 | ||
|
34a07aa4d5 | ||
|
a43aff41cf | ||
|
5aa4b5813c | ||
|
5beb3dfe39 | ||
|
7c741d63e6 | ||
|
b672b3b77c | ||
|
244e03d542 | ||
|
5aed0a18c2 | ||
|
058a60fbf4 | ||
|
08c40f31f3 | ||
|
0375286dcf | ||
|
17b6359ba9 | ||
|
6ab80ec17d | ||
|
5da063f7e7 | ||
|
82c6aa3162 | ||
|
a186488b30 | ||
|
196914ef14 | ||
|
f9ed96a3e4 | ||
|
2ace3c327a | ||
|
a6fc84bc9b | ||
|
78e4f47c8f | ||
|
059e105652 | ||
|
aa2ce8fd73 | ||
|
80d0c2575e | ||
|
209f71d692 | ||
|
6544ff872e | ||
|
59a0afd3df | ||
|
e618c988a4 | ||
|
19d497c4d1 | ||
|
dcc9e0ef14 | ||
|
963700e3d6 | ||
|
b87670431a | ||
|
ad65327732 | ||
|
17182aea86 | ||
|
24ede72e4a | ||
|
263106b117 | ||
|
b5324e9581 | ||
|
76b8316b5c | ||
|
1541788856 | ||
|
eb5837315c | ||
|
c0a820612c | ||
|
445b31db3f | ||
|
3df9137f39 | ||
|
79125b35a8 | ||
|
334bfd1f37 | ||
|
654aca86ef | ||
|
f911af422f | ||
|
acf38c1b62 | ||
|
3b006be691 | ||
|
75785db7e4 | ||
|
8b48d77cbb | ||
|
5d80d86a0c | ||
|
5f360ca78b | ||
|
0cdbc996a9 | ||
|
6c4099258c | ||
|
97aa34218f | ||
|
0f8d024577 | ||
|
bf394dce9c | ||
|
b4a148712e | ||
|
5792e6dbfc | ||
|
d894b87557 | ||
|
f1db0b7265 | ||
|
af6ec6a874 | ||
|
478033988a | ||
|
340d101ffd | ||
|
6e70451153 | ||
|
19997eb5c1 | ||
|
b9df6e5d27 | ||
|
3edc315827 | ||
|
eab302cc30 | ||
|
b7fc2a0ccf | ||
|
db013f327c | ||
|
98d05ffe44 | ||
|
4e2edf5d4f | ||
|
4228651008 | ||
|
6139623d1e | ||
|
93a9d4bb47 | ||
|
dab7063bc1 | ||
|
0e1fad82d3 | ||
|
78c6f1622a | ||
|
2dff311c2a | ||
|
f06ea6a5b6 | ||
|
9e127b1771 | ||
|
196afa593c | ||
|
58ced060bf | ||
|
bd2c3557bc | ||
|
3c0c85f3a5 | ||
|
27f8ec6f47 | ||
|
f2a5703959 | ||
|
2a05234abb | ||
|
486dfc7197 | ||
|
684a1b9836 | ||
|
be30cbfa45 | ||
|
7bb6b0a2cc | ||
|
21907bf78c | ||
|
71a0c53576 | ||
|
13412a4318 | ||
|
21ddb6e18a | ||
|
18d31ca7ee | ||
|
55b4d1a424 | ||
|
1ab5955e3d | ||
|
9396623f6f | ||
|
18d49572ee | ||
|
1efa2a8783 | ||
|
94cdea40d3 | ||
|
ce45c22ac0 | ||
|
f1f0317cce | ||
|
cc279c49d0 | ||
|
bc6d46ce5d | ||
|
20aaffe6bd | ||
|
9d1a01891c | ||
|
0bc7e0d6b1 | ||
|
98712ea405 | ||
|
ffe529218b | ||
|
34c9eb4279 | ||
|
b531ee6acb | ||
|
d8e498111e | ||
|
be6efbe7ba | ||
|
715c206bab | ||
|
d32078bd43 | ||
|
4e43654f0a | ||
|
fc3846ac2f | ||
|
12c4b63b33 | ||
|
e082b8e3d7 | ||
|
d1a269c0cb | ||
|
b964564325 | ||
|
233b83b218 | ||
|
4e885f7c5c | ||
|
372a9c4b82 | ||
|
e0617baf52 | ||
|
4998c77d29 | ||
|
dcacd40e33 | ||
|
da18e28fbf | ||
|
950ad36c3a | ||
|
e28350370e | ||
|
75af5d310e | ||
|
35f05690ed | ||
|
17c636f2f7 | ||
|
bd84b332de | ||
|
711ddd72ab | ||
|
f46b6e594a | ||
|
94538f96d0 | ||
|
15b5d6052c | ||
|
1a519dc39d | ||
|
fcd0c869e2 | ||
|
9fb7764ebc | ||
|
fdae99568e | ||
|
635a857419 | ||
|
ebe3320d03 | ||
|
5abf1258c2 | ||
|
6f7585f7a4 | ||
|
be1775dc44 | ||
|
03d439d49c | ||
|
7c4cd31b73 | ||
|
1806cf14dc | ||
|
da0b2d8249 | ||
|
ea33c39542 | ||
|
56f365b1a0 | ||
|
cb8e9ca4d7 | ||
|
2bb51c8462 | ||
|
e287500b99 | ||
|
e60d0be099 | ||
|
b5e637be5f | ||
|
0087c6cd17 | ||
|
ae829b3ac0 | ||
|
35b76bb231 | ||
|
a180a70e83 | ||
|
5c25a46af2 | ||
|
4111197fd7 | ||
|
f4110f9817 | ||
|
6ff7f19613 | ||
|
8b3327c10b | ||
|
cfebdb4e0d | ||
|
37fbd2d382 | ||
|
c900c7c4ce | ||
|
8a9d120d5c | ||
|
9f1a78361e | ||
|
90b0b362c8 | ||
|
5dcf71e0a8 | ||
|
591040d68e | ||
|
9e041e9b35 | ||
|
c312302b39 | ||
|
e617310415 | ||
|
82979d58d8 | ||
|
24b85f1573 | ||
|
a7673e0ac3 | ||
|
7fc6faaddc | ||
|
ffb201e9cb | ||
|
57c4c0e22a | ||
|
1293803645 | ||
|
847052d58a | ||
|
d52982ba41 | ||
|
1d906ebdf1 | ||
|
761ba276ce | ||
|
ae84c3ad36 | ||
|
6021cce07b | ||
|
c92e82d1c2 | ||
|
8c3ae8ddba | ||
|
93438554c3 | ||
|
9d220fdfad | ||
|
7b95ed074e | ||
|
3da9e8ca27 | ||
|
ef3a931684 | ||
|
46dbf0ce36 | ||
|
4469cb1820 | ||
|
f76a08b9a0 | ||
|
d6cf2a702d | ||
|
ea418f3ff1 | ||
|
842c395eae | ||
|
f81be77e3b | ||
|
c7e5eeba89 | ||
|
907f26aab5 | ||
|
2d92329112 | ||
|
bdf1f9e902 | ||
|
cb04cf2bb5 | ||
|
74db97895a | ||
|
f0f502f8ab | ||
|
3dfb67766c | ||
|
78d4babed7 | ||
|
f33f962c25 | ||
|
b010cead23 | ||
|
54c00a562f | ||
|
560bdde237 | ||
|
567dbdeb5b | ||
|
d7830b79c8 | ||
|
c0007e5b0a | ||
|
78bf74dc1d | ||
|
7c84efcd92 | ||
|
8562d733c5 | ||
|
b97e7068dc | ||
|
b97769af80 | ||
|
e89f88456b | ||
|
ca05e41d9f | ||
|
df3d681858 | ||
|
8152e6b4ee | ||
|
f3ac6d9d8a | ||
|
d98014879b | ||
|
8dde4d19e4 | ||
|
360e820370 | ||
|
078e0502af | ||
|
906750c769 | ||
|
7b81179dce | ||
|
912965080b | ||
|
c0a699944f | ||
|
2ca9202b6e | ||
|
2651233f3f | ||
|
4bae7d4a63 | ||
|
e0fe4ae4e3 | ||
|
26fafd712c | ||
|
405a68887b | ||
|
f8767ee74f | ||
|
6abca97576 | ||
|
20d074fc08 | ||
|
3b73fff1fc | ||
|
2613728937 | ||
|
affd155f9c | ||
|
615124400c | ||
|
84dc841e64 | ||
|
d334376dd6 | ||
|
4cddbeda45 | ||
|
a0f1d6efca | ||
|
e9ecaf9b08 | ||
|
eb2972f8fb | ||
|
7c094590a7 | ||
|
07308c6ccf | ||
|
77f710f67e | ||
|
912da0d4b3 | ||
|
79ae98bbb0 | ||
|
102557c7ca | ||
|
2a4aa4f0b8 | ||
|
d27ac097b1 | ||
|
9c2e1a4b7b | ||
|
a8749dd060 | ||
|
da048c3aa0 | ||
|
aab308dba1 | ||
|
099849f7ff | ||
|
95eb255d35 | ||
|
28c343707e | ||
|
c1c7f004d4 | ||
|
18efb7552d | ||
|
039b7f2d99 | ||
|
be6c8bbcf1 | ||
|
e1689431f6 | ||
|
a255e0650c | ||
|
c3960f94ee | ||
|
b7fb534bb9 | ||
|
b6ab133ce1 | ||
|
760149038d | ||
|
c816587571 | ||
|
a35a744f7a | ||
|
e5b908e541 | ||
|
491745fd36 | ||
|
10ccc32c63 | ||
|
85941fac98 | ||
|
1c0d8df3db | ||
|
c546135d3e | ||
|
bd0738109c | ||
|
082fb0ae70 | ||
|
b013152da8 | ||
|
de94278815 | ||
|
43211ec2b7 | ||
|
7928e2b4e5 | ||
|
00ca943852 | ||
|
bf26cfe775 | ||
|
b4c12c1a73 | ||
|
3517ccbc92 | ||
|
3ce2f4a4c5 | ||
|
6607fcc0ef | ||
|
45320c4c28 | ||
|
1a3b127a7e | ||
|
ae023c0c49 | ||
|
0d792e2a6d | ||
|
2db88e2844 | ||
|
daa35431f2 | ||
|
1f210b10e8 | ||
|
a2e0ccf011 | ||
|
524a2e7ceb | ||
|
05c75052d3 | ||
|
2fc703c5de | ||
|
6e95a9a1e5 | ||
|
09bc065c63 | ||
|
7a09098880 | ||
|
94ee603288 | ||
|
0cd4ab00c7 | ||
|
55f05b710b | ||
|
194e62f47a | ||
|
b8a1ac5612 | ||
|
e885b519a6 | ||
|
01c3eadcf5 | ||
|
8b186c4ad7 | ||
|
dde3badacc | ||
|
8c5d1ef6ed | ||
|
89697c5df2 | ||
|
0f642e77d4 | ||
|
f2a055ef97 | ||
|
03a7c073c2 | ||
|
e8c6874eb1 | ||
|
9f00b0da00 | ||
|
9515b6703f | ||
|
baa1cfbd35 | ||
|
67dfd71e53 | ||
|
1a6b1b6f5b | ||
|
e5681f4a50 | ||
|
9f0394f9c3 | ||
|
a6359c679d | ||
|
0f3a1e0ba4 | ||
|
d6a49c572a | ||
|
a002b0c43c | ||
|
ace38821ad | ||
|
96516dd723 | ||
|
f8d2b38fe4 | ||
|
7756df5dbf | ||
|
e6ce23e63b | ||
|
8300389ecf | ||
|
8c23bab5c2 | ||
|
64995148d5 | ||
|
29d7d59abc | ||
|
ec139b282b | ||
|
51459e04f9 | ||
|
628a5ffa00 | ||
|
6ee8943ebf | ||
|
9d2a79b3a4 | ||
|
863a0c679b | ||
|
5b5c07c061 | ||
|
c756ee4dd3 | ||
|
aaab08aa2a | ||
|
0e196e0fd1 | ||
|
811a306f55 | ||
|
9ae293917b | ||
|
e61398e79c | ||
|
dfb30e2882 | ||
|
4b2e398b0d | ||
|
ecec5ece13 | ||
|
8f26eb4a77 | ||
|
e8bc76c5b3 | ||
|
9724c929cb | ||
|
c3c4cfcc79 | ||
|
7a92c39ce5 | ||
|
5c6a72a7ca | ||
|
c81a433761 | ||
|
ea0d43d72f | ||
|
ae3f0a1870 | ||
|
d40f593b64 | ||
|
1699452ef8 | ||
|
41f163d735 | ||
|
7ea7dc4063 | ||
|
6817d12843 | ||
|
923416f666 | ||
|
2c703a94f5 | ||
|
2e847b959a | ||
|
cb81af5c42 | ||
|
bc9f8bb1f3 | ||
|
e98d337210 | ||
|
baafc22e05 | ||
|
375f9098a5 | ||
|
3c30f7fbd0 | ||
|
58757ae6d4 | ||
|
a417d8581e | ||
|
9b5a3b8e4c | ||
|
6f85c6383a | ||
|
183dfb4adb | ||
|
719bf01886 | ||
|
feac055af8 | ||
|
d1787e2c9c | ||
|
8f3e4f1b6e | ||
|
5e5fa71d5a | ||
|
7866230c2c | ||
|
62c8affc56 | ||
|
1d26215e7f | ||
|
c3aa1d47a0 | ||
|
ed890b7e2e | ||
|
f0c308711b | ||
|
6a062ed252 | ||
|
90c55771fd | ||
|
fd51336457 | ||
|
55e2966fb3 | ||
|
763d325c6a | ||
|
cc43e948dc | ||
|
073b6a650d | ||
|
321b334912 | ||
|
4b0be76f13 | ||
|
f41650b9b8 | ||
|
66b546f33f | ||
|
f684926ec8 | ||
|
38d424a25e | ||
|
591ef01a5b | ||
|
fc1d806411 | ||
|
eefe748587 | ||
|
96c021a74f | ||
|
ca0d589c85 | ||
|
1d1c796f67 | ||
|
466f1709f2 | ||
|
43e24cad84 | ||
|
cd2924d9ab | ||
|
dad9dde30e | ||
|
3ea83315ba | ||
|
50ac933d43 | ||
|
94baea2b63 | ||
|
0f85f9390c | ||
|
61691b8689 | ||
|
9feb86a622 | ||
|
c35bd787df | ||
|
32be29331b | ||
|
dfa1083363 | ||
|
077d9acf41 | ||
|
dd04c2f9b6 | ||
|
0fcb14a78f | ||
|
d616702b69 | ||
|
f3d2771081 | ||
|
173eb165ac | ||
|
1597cd9cee | ||
|
b41546414a | ||
|
08029f654a | ||
|
8c5c85d4db | ||
|
00d1c0f635 | ||
|
5fbc998044 | ||
|
2269ad78ec | ||
|
cf5e1561a9 |
274 changed files with 12330 additions and 5592 deletions
23
.github/scripts/build.sh
vendored
Executable file
23
.github/scripts/build.sh
vendored
Executable file
|
@ -0,0 +1,23 @@
|
|||
#! /usr/bin/env sh
|
||||
|
||||
set -ex
|
||||
|
||||
echo "Building..."
|
||||
|
||||
# build dependencies...
|
||||
./.github/scripts/dependencies.sh
|
||||
|
||||
export LIBRARY_PATH=$HOME/staging/lib:$HOME/staging/lib64:$LIBRARY_PATH;
|
||||
export LD_LIBRARY_PATH=$HOME/staging/lib:$HOME/staging/lib64:$LD_LIBRARY_PATH;
|
||||
if [ $LIBRARY_COMBO = 'ng-gnu-gnu' ];
|
||||
then
|
||||
export CPATH=$HOME/staging/include;
|
||||
else
|
||||
export CPATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/include;
|
||||
fi;
|
||||
export PATH=$HOME/staging/bin:$PATH;
|
||||
export GNUSTEP_MAKEFILES=$HOME/staging/share/GNUstep/Makefiles;
|
||||
. $HOME/staging/share/GNUstep/Makefiles/GNUstep.sh;
|
||||
|
||||
# Build gorm
|
||||
make && make install && make check || (cat Tests/tests.log && false);
|
135
.github/scripts/dependencies.sh
vendored
Executable file
135
.github/scripts/dependencies.sh
vendored
Executable file
|
@ -0,0 +1,135 @@
|
|||
#! /usr/bin/env sh
|
||||
|
||||
set -ex
|
||||
|
||||
DEP_SRC=$HOME/dependency_source/
|
||||
DEP_ROOT=$HOME/staging
|
||||
|
||||
install_prerequisites() {
|
||||
sudo apt-get -qq update
|
||||
sudo apt-get install -y cmake pkg-config libgnutls28-dev libgmp-dev libffi-dev libicu-dev \
|
||||
libxml2-dev libxslt1-dev libssl-dev libavahi-client-dev zlib1g-dev
|
||||
|
||||
if [ $LIBRARY_COMBO = 'gnu-gnu-gnu' ];
|
||||
then
|
||||
if [ $CC = 'gcc' ];
|
||||
then
|
||||
sudo apt-get install -y gobjc;
|
||||
fi;
|
||||
sudo apt-get install -y libobjc-8-dev libblocksruntime-dev;
|
||||
else
|
||||
curl -s -o - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -;
|
||||
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" && sudo apt-get update -qq;
|
||||
sudo apt-get install -y clang-9 libkqueue-dev libpthread-workqueue-dev;
|
||||
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-9 10 \
|
||||
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-9;
|
||||
export PATH=$(echo "$PATH" | sed -e 's/:\/usr\/local\/clang-7.0.0\/bin//');
|
||||
if [ "$RUNTIME_VERSION" = "gnustep-2.0" ];
|
||||
then
|
||||
sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 10;
|
||||
fi;
|
||||
fi;
|
||||
if [ $LIBRARY_COMBO = 'ng-gnu-gnu' ];
|
||||
then
|
||||
curl -LO https://cmake.org/files/v3.15/cmake-3.15.5-Linux-x86_64.tar.gz;
|
||||
tar xf cmake-3.15.5-Linux-x86_64.tar.gz;
|
||||
mv cmake-3.15.5-Linux-x86_64 $HOME/cmake;
|
||||
export PATH=$HOME/cmake/:$HOME/cmake/bin:$PATH
|
||||
fi;
|
||||
}
|
||||
|
||||
install_gnustep_make() {
|
||||
cd $DEP_SRC
|
||||
git clone https://github.com/gnustep/tools-make.git
|
||||
cd tools-make
|
||||
if [ -n "$RUNTIME_VERSION" ]
|
||||
then
|
||||
WITH_RUNTIME_ABI="--with-runtime-abi=${RUNTIME_VERSION}"
|
||||
else
|
||||
WITH_RUNTIME_ABI=""
|
||||
fi
|
||||
./configure --prefix=$DEP_ROOT --with-library-combo=$LIBRARY_COMBO $WITH_RUNTIME_ABI
|
||||
make install
|
||||
echo Objective-C build flags: `$HOME/staging/bin/gnustep-config --objc-flags`
|
||||
}
|
||||
|
||||
install_ng_runtime() {
|
||||
cd $DEP_SRC
|
||||
git clone https://github.com/gnustep/libobjc2.git
|
||||
cd libobjc2
|
||||
git submodule init
|
||||
git submodule sync
|
||||
git submodule update
|
||||
cd ..
|
||||
mkdir libobjc2/build
|
||||
cd libobjc2/build
|
||||
export CC="clang"
|
||||
export CXX="clang++"
|
||||
export CXXFLAGS="-std=c++11"
|
||||
cmake -DTESTS=off -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGNUSTEP_INSTALL_TYPE=NONE -DCMAKE_INSTALL_PREFIX:PATH=$DEP_ROOT ../
|
||||
make install
|
||||
}
|
||||
|
||||
install_libdispatch() {
|
||||
cd $DEP_SRC
|
||||
# will reference upstream after https://github.com/apple/swift-corelibs-libdispatch/pull/534 is merged
|
||||
git clone -b system-blocksruntime https://github.com/ngrewe/swift-corelibs-libdispatch.git
|
||||
mkdir swift-corelibs-libdispatch/build
|
||||
cd swift-corelibs-libdispatch/build
|
||||
export CC="clang"
|
||||
export CXX="clang++"
|
||||
export LIBRARY_PATH=$DEP_ROOT/lib;
|
||||
export LD_LIBRARY_PATH=$DEP_ROOT/lib:$LD_LIBRARY_PATH;
|
||||
export CPATH=$DEP_ROOT/include;
|
||||
cmake -DBUILD_TESTING=off -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH=$HOME/staging -DINSTALL_PRIVATE_HEADERS=1 -DBlocksRuntime_INCLUDE_DIR=$DEP_ROOT/include -DBlocksRuntime_LIBRARIES=$DEP_ROOT/lib/libobjc.so ../
|
||||
make install
|
||||
}
|
||||
|
||||
install_gnustep_base() {
|
||||
export GNUSTEP_MAKEFILES=$HOME/staging/share/GNUstep/Makefiles
|
||||
. $HOME/staging/share/GNUstep/Makefiles/GNUstep.sh
|
||||
|
||||
cd $DEP_SRC
|
||||
git clone https://github.com/gnustep/libs-base.git
|
||||
cd libs-base
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
}
|
||||
|
||||
install_gnustep_gui() {
|
||||
export GNUSTEP_MAKEFILES=$HOME/staging/share/GNUstep/Makefiles
|
||||
. $HOME/staging/share/GNUstep/Makefiles/GNUstep.sh
|
||||
|
||||
cd $DEP_SRC
|
||||
git clone https://github.com/gnustep/libs-gui.git
|
||||
cd libs-gui
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
}
|
||||
|
||||
install_gnustep_back() {
|
||||
export GNUSTEP_MAKEFILES=$HOME/staging/share/GNUstep/Makefiles
|
||||
. $HOME/staging/share/GNUstep/Makefiles/GNUstep.sh
|
||||
|
||||
cd $DEP_SRC
|
||||
git clone https://github.com/gnustep/libs-back.git
|
||||
cd libs-back
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
}
|
||||
|
||||
mkdir -p $DEP_SRC
|
||||
if [ "$LIBRARY_COMBO" = 'ng-gnu-gnu' ]
|
||||
then
|
||||
install_ng_runtime
|
||||
install_libdispatch
|
||||
fi
|
||||
|
||||
install_prerequisites
|
||||
install_gnustep_make
|
||||
install_gnustep_base
|
||||
install_gnustep_gui
|
||||
install_gnustep_back
|
10
.github/scripts/test.sh
vendored
Executable file
10
.github/scripts/test.sh
vendored
Executable file
|
@ -0,0 +1,10 @@
|
|||
#! /usr/bin/env sh
|
||||
|
||||
set -ex
|
||||
|
||||
echo "Testing..."
|
||||
|
||||
. $HOME/staging/share/GNUstep/Makefiles/GNUstep.sh;
|
||||
|
||||
# Test gorm
|
||||
make check || (cat Tests/tests.log && false);
|
38
.github/workflows/main.yml
vendored
Normal file
38
.github/workflows/main.yml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: CI
|
||||
|
||||
# Controls when the workflow will run
|
||||
on: push
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run
|
||||
# sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
LIBRARY_COMBO: gnu-gnu-gnu
|
||||
CC: gcc
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as
|
||||
# part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE,
|
||||
# so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# Runs a single command using the runners shell
|
||||
- name: Build source
|
||||
run: ./.github/scripts/build.sh
|
||||
|
||||
# Runs a single command using the runners shell
|
||||
- name: Run tests
|
||||
run: ./.github/scripts/test.sh
|
||||
|
||||
# Runs a set of commands using the runners shell
|
||||
- name: Run a multi-line script
|
||||
run: |
|
||||
echo Add other actions to build,
|
||||
echo test, and deploy your project.
|
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
*.app
|
||||
*.debug
|
||||
*.profile
|
||||
*.plugin
|
||||
*.framework
|
||||
*.debugger
|
||||
*.editor
|
||||
*.parser
|
||||
*.preferences
|
||||
*.project
|
||||
*.swp
|
||||
derived_src
|
||||
obj
|
||||
*~
|
6
CODEOWNERS
Normal file
6
CODEOWNERS
Normal file
|
@ -0,0 +1,6 @@
|
|||
# These owners will be the default owners for everything in
|
||||
# the repo. Unless a later match takes precedence,
|
||||
# @global-owner1 and @global-owner2 will be requested for
|
||||
# review when someone opens a pull request.
|
||||
* @rmottola
|
||||
* @gcasa
|
73
Documentation/BUGS
Normal file
73
Documentation/BUGS
Normal file
|
@ -0,0 +1,73 @@
|
|||
KNOWN BUGS:
|
||||
~~~~~~~~~~
|
||||
- [bug #25571] exception on removing author in project inspector.
|
||||
This happens to me with project-center-0.5.0.
|
||||
in the Project Inspector -> Project Description, click the Add button to
|
||||
add an Author now the text input field is active, to add an author, as
|
||||
long as this is active, and then pressing remove button, to remove an
|
||||
author, then PC exits with the following exception:
|
||||
|
||||
NSRangeException: Index 1 is out of range 1 (in 'removeObjectAtIndex:')
|
||||
|
||||
- [sr #106614] ProjectCenter, document type extensions.
|
||||
In the project center project properties editor, if there are several
|
||||
extensions separated bya space, they should be encoded as element arrays
|
||||
|
||||
- [bug #25193] pc fails to load project from ImageViewer.pc.project.
|
||||
|
||||
- [bug #22815] ProjectCenter won't open a new project .
|
||||
[doesn't work for me]
|
||||
|
||||
- [bug #22411] font types in ProjectCenter Editor.
|
||||
|
||||
- [bug #22441] Usability: Project Center should have a separate project type
|
||||
for Renaissance based applications
|
||||
|
||||
- [bug #22124] ProjectCenter doesn't support extra entries in Plist.
|
||||
|
||||
- [bug #22008] Project Center should support more flexible directory
|
||||
configurations.
|
||||
|
||||
- [bug #22026] ProjectCenter should split up project file.
|
||||
|
||||
- [bug #11931] Build before launch on change.
|
||||
|
||||
- [bug #20858] UI components (editor, builder, launcher).
|
||||
The latest change fixes the initial problem but introduces a new one!
|
||||
|
||||
The new issue is that doesn't matter what I check or uncheck on the Interface
|
||||
Preferences the only thing that is shown is the Editor in the SplitView.
|
||||
It's reproducable every time, no matter what. All you need to do is check
|
||||
every option, so that only the browser will be shown, then uncheck random
|
||||
options.
|
||||
|
||||
On another note, but still related, when the Editor is shown (after being
|
||||
hidden by the preferences) it doesn't preserve it's previous size.
|
||||
|
||||
RELEASE CRTITICAL UNKNOWN BUGS:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
- ProjectBuilder's incorrectly parses output of gnustep-make (incorrect
|
||||
directories, incorrectly recognises initial point of error etc.).
|
||||
- Browser must be double checked for correct behaviour on browsing,
|
||||
file removal, opening editor (currently is bad).
|
||||
- It seems that changing subproject's attributes doesn't change 'edited'
|
||||
state of project window.
|
||||
- Removing files works bad (crashes, strange warnings, exceptions). Check it!
|
||||
Maybe this happens only in subprojects... It may be connected to browser's
|
||||
functionality.
|
||||
- PC tries to load internal editor for .gorm files. Fix it!!!
|
||||
- Setting localizable resources through inspector works bad. Double check it
|
||||
and fix!!! Also check this functionality when multiple files selected.
|
||||
- Double check support for "Resource Set" project type as subproject of
|
||||
existing projecttypes.
|
||||
-
|
||||
|
||||
WHISH LIST:
|
||||
~~~~~~~~~~
|
||||
+ Open panel with list of modified files on project close and project build.
|
||||
- Think about browser initial responder status: now very uncomfortable
|
||||
to find some file in browser list when editor is open.
|
||||
- "Project Attributes" for Application should be reviewed after split of
|
||||
"Application" to "Application" and "Renaissance" project types.
|
||||
- Add setting to preferences "Create template-based files on project creation".
|
||||
It should allow to switch off creation of .m, .h, .gorm files from templates.
|
|
@ -1,4 +1,4 @@
|
|||
TODO
|
||||
TODO
|
||||
****
|
||||
|
||||
This is the GNUstep ProjectCenter TODO list.
|
||||
|
@ -24,7 +24,7 @@ ProjectCenter 0.5
|
|||
- Add "Resource Set" project type [done!]
|
||||
- Implement on demand loading of bundles [done!]
|
||||
- Localization support for projects [done!]
|
||||
+ Finish save/restore size of split views in Project Window [done!]
|
||||
- Finish save/restore size of split views in Project Window [done!]
|
||||
--- Project Editor:
|
||||
- Implement on demand loading (editor for file type) [done!]
|
||||
- Open some files read only (Supporting Files) [done!]
|
||||
|
@ -38,50 +38,81 @@ ProjectCenter 0.5
|
|||
- Parse gcc output [95% done!]
|
||||
- Display warnings,errors,options etc. as clickable list [done!]
|
||||
- GNUstep make version 2.0 compliance [done!]
|
||||
- Finish FileNameIcon (draggable, files can be dragged to it) stoyan
|
||||
- Save last used path separately for different file panels [done!]
|
||||
- Review all situations when dialogs must be popped up stoyan
|
||||
|
||||
ProjectCenter 0.6
|
||||
-----------------
|
||||
|
||||
- Better integration with other tools (GORM) ???
|
||||
- Rewrite Preferences (3rd party sections etc.) stoyan
|
||||
- Add "Palette" project type stoyan
|
||||
- Add "Component" project type stoyan
|
||||
- Create new Info panel stoyan
|
||||
- More options for file creation stoyan
|
||||
- Think about imlementing pending adding/removal of files stoyan
|
||||
--- Project Editor ---------------------------------------------
|
||||
- Implement indentation stoyan
|
||||
- Implement interaction with Builder (errors, warnings) stoyan
|
||||
- Create new Info panel [done!]
|
||||
- Implement support for integrated debugging [90% done]
|
||||
- change project type from file to bundle [done!] casamento/mottola
|
||||
- Finish FileNameIcon (draggable, files can be dragged to it) [done!]
|
||||
- More options for file creation [done!]
|
||||
- Review all situations when dialogs must be popped up [done!]
|
||||
- Check all textfields if 'scrollable' attribute set [done!]
|
||||
- Rewrite Preferences (3rd party sections etc.) [done!]
|
||||
--- Project Builder --------------------------------------------
|
||||
- Finish parsing gcc output (make errors, etc.)
|
||||
- Implement interaction with Editor (errors, warnings) stoyan
|
||||
- New icons. Need volonteers!!! ???
|
||||
- Review build, compiler, linker options setting
|
||||
(Build Options, Inspector) [done!]
|
||||
- Finish parsing build output (compiler errors/warnings,
|
||||
make errors, gnustep-make verbose mode) stoyan
|
||||
- Finish interaction with Editor (errors, warnings) stoyan
|
||||
- Add support for running configurable(Build Options)
|
||||
command before and after make stoyan
|
||||
--- Project Editor ---------------------------------------------
|
||||
- review situations when editor is opened stoyan
|
||||
- implement go to line stoyan
|
||||
- Implement interaction with Builder (errors, warnings) stoyan
|
||||
- Implement indentation stoyan
|
||||
- implement undo inside editor [done!]
|
||||
- Add and use basic editor preferences (fonts, colors, sizes) [50% done]
|
||||
--- Project Inspector ------------------------------------------
|
||||
- Make sections as loadable bundles stoyan
|
||||
- Finish functionality of all sections stoyan
|
||||
- Review all sections for correct behaviour stoyan
|
||||
- Split "Application" to "Application GORM" and
|
||||
"Application Renaissance" project types stoyan
|
||||
- Add "Palette" project type ???
|
||||
- Add "Component" project type ???
|
||||
- Process reported bugs ???
|
||||
- Think about imlementing pending adding/removal of files ???
|
||||
- New icons. Need volunteers!!! ???
|
||||
|
||||
ProjectCenter 0.7
|
||||
-----------------
|
||||
|
||||
- Finish suppor of integrated debugging ???
|
||||
- Add support for browsing 'Library' category entries ???
|
||||
- Add support for non-project files ???
|
||||
- Implement symbols indexing. This feature touches Browser
|
||||
(class and method list) and Editor (autocompletion) ???
|
||||
- Editor: implement autocompletion ???
|
||||
- An initial project wide find feature ???
|
||||
- Implement support for integrated debugging ???
|
||||
- CVS/SVN integration ???
|
||||
- Better integration with other tools (GORM). DevKit? ???
|
||||
|
||||
ProjectCenter 0.8
|
||||
-----------------
|
||||
|
||||
- Initial user documentation ???
|
||||
- Implement code folding in Editor ???
|
||||
- Direct code documentation (using autogsdoc) ???
|
||||
- Think about adopting existing directory tree (more flexible
|
||||
directory configurations) [bug #22008] ???
|
||||
|
||||
ProjectCenter 0.9
|
||||
-----------------
|
||||
|
||||
- ProjectCenter localization ???
|
||||
- Initial user documentation ???
|
||||
- Implement Plist editor for editing project files[bug #22124] ???
|
||||
- An initial class browser/documentation feature ???
|
||||
|
||||
ProjectCenter 1.0
|
||||
-----------------
|
||||
|
||||
Version 1.0 is aimed at stabilising and optimising existing
|
||||
Version 1.0 is aimed at stabilising and optimising existing
|
||||
features. There will not be any new features since 0.9.
|
||||
|
||||
After 1.0
|
||||
---------
|
||||
- CVS/SVN integration ???
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,3 +1,20 @@
|
|||
{
|
||||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"showInfoWindow:"
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
PCInfoController = {
|
||||
Actions = (
|
||||
"showInfoWindow:"
|
||||
);
|
||||
Outlets = (
|
||||
infoWindow,
|
||||
versionField,
|
||||
copyrightField
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
}
|
Binary file not shown.
Binary file not shown.
|
@ -64,7 +64,9 @@
|
|||
editorColumnsField,
|
||||
editorLinesField,
|
||||
displayLog,
|
||||
buildToolField
|
||||
buildToolField,
|
||||
debuggerButton,
|
||||
buildToolButton
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
BIN
English.lproj/Preferences.gorm/data.info
Normal file
BIN
English.lproj/Preferences.gorm/data.info
Normal file
Binary file not shown.
BIN
English.lproj/Preferences.gorm/objects.gorm
Normal file
BIN
English.lproj/Preferences.gorm/objects.gorm
Normal file
Binary file not shown.
|
@ -7,7 +7,7 @@
|
|||
"findNext:",
|
||||
"findPrevious:",
|
||||
"findShowPanel:",
|
||||
"newAction:"
|
||||
"performGoToLinePanelAction:"
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -32,9 +32,9 @@
|
|||
objcOptField,
|
||||
cOptField,
|
||||
ldOptField,
|
||||
installPathField,
|
||||
searchOrderScroll,
|
||||
searchOrderColumn
|
||||
searchOrderColumn,
|
||||
installDomainPopup
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -10,6 +10,13 @@
|
|||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
PCAuxiliaryWindow = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
);
|
||||
Super = NSWindow;
|
||||
};
|
||||
PCProjectBuilderPanel = {
|
||||
Actions = (
|
||||
);
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -21,7 +21,8 @@
|
|||
nfDescriptionTV,
|
||||
nfNameField,
|
||||
nfCancelButton,
|
||||
nfCreateButton
|
||||
nfCreateButton,
|
||||
nfAddHeaderButton
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
22
Framework/English.lproj/ProjectLanguages.gorm/data.classes
Normal file
22
Framework/English.lproj/ProjectLanguages.gorm/data.classes
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"addLanguage:",
|
||||
"removeLanguage:"
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
PCProjectInspector = {
|
||||
Actions = (
|
||||
"addLanguage:",
|
||||
"removeLanguage:"
|
||||
);
|
||||
Outlets = (
|
||||
projectLanguagesView,
|
||||
languagesList,
|
||||
newLanguage
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
}
|
BIN
Framework/English.lproj/ProjectLanguages.gorm/data.info
Normal file
BIN
Framework/English.lproj/ProjectLanguages.gorm/data.info
Normal file
Binary file not shown.
BIN
Framework/English.lproj/ProjectLanguages.gorm/objects.gorm
Normal file
BIN
Framework/English.lproj/ProjectLanguages.gorm/objects.gorm
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Framework/English.lproj/SaveModified.gorm/ProjectCenter.tiff
Normal file
BIN
Framework/English.lproj/SaveModified.gorm/ProjectCenter.tiff
Normal file
Binary file not shown.
29
Framework/English.lproj/SaveModified.gorm/data.classes
Normal file
29
Framework/English.lproj/SaveModified.gorm/data.classes
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"buttonClicked:"
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
PCAuxiliaryWindow = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
);
|
||||
Super = NSWindow;
|
||||
};
|
||||
SaveModifiedFilesDelegate = {
|
||||
Actions = (
|
||||
"buttonClicked:"
|
||||
);
|
||||
Outlets = (
|
||||
alternateButton,
|
||||
defaultButton,
|
||||
panel,
|
||||
otherButton,
|
||||
filesList
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
}
|
BIN
Framework/English.lproj/SaveModified.gorm/data.info
Normal file
BIN
Framework/English.lproj/SaveModified.gorm/data.info
Normal file
Binary file not shown.
BIN
Framework/English.lproj/SaveModified.gorm/objects.gorm
Normal file
BIN
Framework/English.lproj/SaveModified.gorm/objects.gorm
Normal file
Binary file not shown.
|
@ -1,20 +1,19 @@
|
|||
#
|
||||
# GNUmakefile - Generated by ProjectCenter
|
||||
#
|
||||
|
||||
GNUSTEP_INSTALLATION_DOMAIN = SYSTEM
|
||||
PACKAGE_NAME = ProjectCenter
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
|
||||
#
|
||||
# Framework
|
||||
#
|
||||
VERSION = 0.5.0
|
||||
VERSION = 0.7.0
|
||||
FRAMEWORK_NAME = ProjectCenter
|
||||
ProjectCenter_CURRENT_VERSION_NAME = 0.5.0
|
||||
ProjectCenter_CURRENT_VERSION_NAME = 0.7.0
|
||||
ProjectCenter_DEPLOY_WITH_CURRENT_VERSION = yes
|
||||
ProjectCenter_HEADER_FILES_DIR = ../Headers/ProjectCenter
|
||||
|
||||
ProjectCenter_LIBRARIES_DEPEND_UPON += -lgnustep-gui
|
||||
ProjectCenter_LIBRARIES_DEPEND_UPON += $(OBJC_LIBS) $(FND_LIBS) $(GUI_LIBS)
|
||||
|
||||
#
|
||||
# Subprojects
|
||||
|
@ -34,6 +33,7 @@ ProjectCenter_HEADER_FILES = \
|
|||
PCAddFilesPanel.h \
|
||||
PCFileCreator.h \
|
||||
PCMakefileFactory.h \
|
||||
PCSaveModified.h \
|
||||
\
|
||||
PCProjectManager.h \
|
||||
PCProject.h \
|
||||
|
@ -50,8 +50,12 @@ ProjectCenter_HEADER_FILES = \
|
|||
PCProjectLoadedFiles.h \
|
||||
PCProjectLoadedFilesPanel.h \
|
||||
\
|
||||
PCPrefController.h \
|
||||
PCLogController.h
|
||||
PCFileNameField.h \
|
||||
PCFileNameIcon.h \
|
||||
\
|
||||
PCLogController.h \
|
||||
\
|
||||
PCAuxiliaryWindow.h
|
||||
|
||||
#
|
||||
# Class files
|
||||
|
@ -64,6 +68,7 @@ ProjectCenter_OBJC_FILES = \
|
|||
PCFileManager.m \
|
||||
PCAddFilesPanel.m \
|
||||
PCFileCreator.m \
|
||||
PCSaveModified.m \
|
||||
\
|
||||
PCProjectManager.m \
|
||||
PCProject.m \
|
||||
|
@ -80,13 +85,13 @@ ProjectCenter_OBJC_FILES = \
|
|||
PCProjectLoadedFiles.m \
|
||||
PCProjectLoadedFilesPanel.m \
|
||||
\
|
||||
PCSplitView.m \
|
||||
PCButton.m \
|
||||
PCFileNameField.m \
|
||||
PCFileNameIcon.m \
|
||||
\
|
||||
PCPrefController.m \
|
||||
PCLogController.m
|
||||
PCLogController.m \
|
||||
\
|
||||
PCAuxiliaryWindow.m
|
||||
|
||||
#
|
||||
# Resources
|
||||
|
@ -99,6 +104,7 @@ ProjectCenter_RESOURCE_FILES = \
|
|||
Resources/header.template \
|
||||
Resources/postamble.template \
|
||||
Resources/protocol.template \
|
||||
Resources/ocppclass.template \
|
||||
|
||||
#
|
||||
# Localization
|
||||
|
@ -114,9 +120,11 @@ ProjectCenter_LOCALIZED_RESOURCE_FILES = \
|
|||
BuildAttributes.gorm \
|
||||
ProjectAttributes.gorm \
|
||||
ProjectDescription.gorm \
|
||||
ProjectLanguages.gorm \
|
||||
FileAttributes.gorm \
|
||||
LogPanel.gorm \
|
||||
Preferences.gorm
|
||||
SaveModified.gorm
|
||||
|
||||
|
||||
ProjectCenter_LANGUAGES = \
|
||||
English
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, write to the Free Software Foundation,
|
||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# 31 Milk Street #960789 Boston, MA 02196 USAA.
|
||||
|
||||
#before-all::
|
||||
# cd ..;rm -f ProjectCenter;$(LN_S) Library ProjectCenter
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, write to the Free Software Foundation,
|
||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# 31 Milk Street #960789 Boston, MA 02196 USAA.
|
||||
|
||||
#
|
||||
# Makefile.preamble
|
||||
|
@ -33,9 +33,10 @@
|
|||
# be put into Makefile.postamble.
|
||||
#
|
||||
|
||||
# TODO: Make sure if it's portable
|
||||
GMAKE = `which gmake`
|
||||
GDB = `which gdb`
|
||||
# FIXME: Why are we hardcoding the full path to 'make' or 'gdb' in
|
||||
# here ? Can't we discover them at runtime ?
|
||||
GMAKE := $(shell which ${MAKE})
|
||||
GDB := $(shell which gdb)
|
||||
|
||||
#
|
||||
# Flags dealing with compiling and linking
|
||||
|
@ -45,7 +46,7 @@ GDB = `which gdb`
|
|||
ADDITIONAL_CPPFLAGS +=
|
||||
|
||||
# Additional flags to pass to the Objective-C compiler
|
||||
ADDITIONAL_OBJCFLAGS += -W -Wno-unused-parameter -DDEVELOPMENT\
|
||||
ADDITIONAL_OBJCFLAGS += -DDEVELOPMENT\
|
||||
-DPCDefaultBuildTool=@"\"$(GMAKE)\"" \
|
||||
-DPCDefaultDebugger=@"\"$(GDB)\""
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation
|
||||
Copyright (C) 2004-2014 Free Software Foundation
|
||||
|
||||
Authors: Serg Stoyan
|
||||
Riccardo Mottola
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
|
@ -19,11 +20,11 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#include <ProjectCenter/PCAddFilesPanel.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCAddFilesPanel.h>
|
||||
|
||||
static PCAddFilesPanel *addFilesPanel = nil;
|
||||
|
||||
|
@ -93,7 +94,7 @@ static PCAddFilesPanel *addFilesPanel = nil;
|
|||
{
|
||||
NSString *path = nil;
|
||||
|
||||
ASSIGN(_fileTypes, fileTypes);
|
||||
[super setAllowedFileTypes: fileTypes];
|
||||
|
||||
path = [_browser path];
|
||||
[self validateVisibleColumns];
|
||||
|
@ -106,9 +107,9 @@ static PCAddFilesPanel *addFilesPanel = nil;
|
|||
{
|
||||
NSString *category = [fileTypePopup titleOfSelectedItem];
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(categoryChangedTo:)])
|
||||
if ([[self delegate] respondsToSelector:@selector(categoryChangedTo:)])
|
||||
{
|
||||
[_delegate categoryChangedTo:category];
|
||||
[[self delegate] categoryChangedTo:category];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
33
Framework/PCAuxiliaryWindow.m
Normal file
33
Framework/PCAuxiliaryWindow.m
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
PCAuxiliaryWindow.m
|
||||
|
||||
Author: German A. Arias <germanandre@gmx.es>
|
||||
Date: September 2013
|
||||
|
||||
This file is part of ProjectCenter.
|
||||
|
||||
ProjectCenter is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#import <ProjectCenter/PCAuxiliaryWindow.h>
|
||||
|
||||
@implementation PCAuxiliaryWindow
|
||||
|
||||
- (BOOL) canBecomeMainWindow
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
// TODO: Finish support for third party bundles.
|
||||
|
@ -31,10 +31,10 @@
|
|||
// - GNUSTEP_SYSTEM_LIBRARY/Bundles/ProjectCenter
|
||||
// (NSApplicationSupportDirectory)
|
||||
|
||||
#include <ProjectCenter/PCBundleManager.h>
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCBundleManager.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
@implementation PCBundleManager
|
||||
|
||||
|
@ -129,6 +129,7 @@
|
|||
reqBundlesInfo = [self infoForBundlesType:extension];
|
||||
enumerator = [[reqBundlesInfo allKeys] objectEnumerator];
|
||||
|
||||
infoTable = nil;
|
||||
while ((bundlePath = [enumerator nextObject]))
|
||||
{
|
||||
infoTable = [reqBundlesInfo objectForKey:bundlePath];
|
||||
|
@ -167,6 +168,7 @@
|
|||
NSString *bundlePath;
|
||||
NSDictionary *infoTable;
|
||||
|
||||
infoTable = nil;
|
||||
while ((bundlePath = [enumerator nextObject]))
|
||||
{
|
||||
infoTable = [reqBundlesInfo objectForKey:bundlePath];
|
||||
|
@ -209,8 +211,8 @@
|
|||
bundlePaths = [bundlesInfo allKeys];
|
||||
enumerator = [bundlePaths objectEnumerator];
|
||||
|
||||
NSLog(@"Bundle fullpath method #1: %@",
|
||||
[[self resourcePath] stringByAppendingPathComponent:bundleName]);
|
||||
// NSLog(@"Bundle fullpath method #1: %@",
|
||||
// [[self resourcePath] stringByAppendingPathComponent:bundleName]);
|
||||
|
||||
while ((bundleFullPath = [enumerator nextObject]))
|
||||
{
|
||||
|
@ -220,7 +222,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
NSLog(@"Bundle fullpath method #2: %@", bundleFullPath);
|
||||
// NSLog(@"Bundle fullpath method #2: %@", bundleFullPath);
|
||||
|
||||
return bundleFullPath;
|
||||
}
|
||||
|
@ -235,6 +237,7 @@
|
|||
|
||||
if (!className)
|
||||
{
|
||||
NSLog(@"Bundle for class called with empty className");
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2003-2004 Free Software Foundation
|
||||
Copyright (C) 2003-2019 Free Software Foundation
|
||||
|
||||
Authors: Serg Stoyan
|
||||
Riccardo Mottola
|
||||
|
||||
This file is part of GNUstep.
|
||||
This file is part of ProjectCenter.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
|
@ -19,14 +20,11 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCButton.h>
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
|
||||
#include <AppKit/NSBezierPath.h>
|
||||
#include <GNUstepGUI/GSTrackingRect.h>
|
||||
#import <ProjectCenter/PCButton.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
|
||||
@implementation PCButton
|
||||
|
||||
|
@ -34,355 +32,19 @@
|
|||
// ==== Main
|
||||
// ============================================================================
|
||||
|
||||
//- (id)initWithFrame:(NSRect)frameRect
|
||||
- (id)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
// self = [super initWithFrame:frameRect];
|
||||
self = [super initWithCoder:coder];
|
||||
[_cell setGradientType:NSGradientConvexWeak];
|
||||
[_cell setImageDimsWhenDisabled:YES];
|
||||
[self setImagePosition:NSImageOnly];
|
||||
[self setFont:[NSFont systemFontOfSize:10.0]];
|
||||
[self setRefusesFirstResponder:YES];
|
||||
|
||||
_hasTooltips = NO;
|
||||
ttTimer = nil;
|
||||
ttWindow = nil;
|
||||
ttTitleAttrs = [[NSMutableDictionary alloc] init];
|
||||
[ttTitleAttrs setObject:[NSFont systemFontOfSize:10.0]
|
||||
forKey:NSFontAttributeName];
|
||||
ttBackground = [NSColor colorWithDeviceRed:1.0 green:1.0 blue:0.90 alpha:1.0];
|
||||
RETAIN(ttBackground);
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(_updateTrackingRects:)
|
||||
name:NSViewFrameDidChangeNotification
|
||||
object:[[self window] contentView]];
|
||||
|
||||
if (self)
|
||||
{
|
||||
[_cell setGradientType:NSGradientConcaveWeak];
|
||||
[_cell setImageDimsWhenDisabled:YES];
|
||||
[self setImagePosition:NSImageOnly];
|
||||
[self setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
|
||||
[self setRefusesFirstResponder:YES];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
#ifdef DEVELOPMENT
|
||||
NSLog(@"PCButton %@: dealloc", [self stringValue]);
|
||||
#endif
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
if (_hasTooltips)
|
||||
{
|
||||
[self removeAllToolTips];
|
||||
RELEASE(ttTitleAttrs);
|
||||
RELEASE(ttBackground);
|
||||
RELEASE(ttWindow);
|
||||
}
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)release
|
||||
{
|
||||
// If retain count is number of tracking rects + superview retain,
|
||||
// remove tracking rects. It seems that tracking rects retain this object.
|
||||
if (_hasTooltips && [self retainCount] == [_tracking_rects count] + 1)
|
||||
{
|
||||
[self removeAllToolTips];
|
||||
}
|
||||
|
||||
[super release];
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ==== Private methods
|
||||
// ============================================================================
|
||||
|
||||
- (void)_updateTrackingRects:(NSNotification *)aNotif
|
||||
{
|
||||
NSTrackingRectTag tag;
|
||||
NSRect rect;
|
||||
NSString *string = nil;
|
||||
int i, j;
|
||||
GSTrackingRect *tr = nil;
|
||||
|
||||
if (_hasTooltips == NO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
j = [_tracking_rects count];
|
||||
for (i = 0; i < j; i++)
|
||||
{
|
||||
tr = [_tracking_rects objectAtIndex:i];
|
||||
|
||||
// Save tooltip string for next addTrackingRect::::
|
||||
string = [(NSString *)tr->user_data copy];
|
||||
|
||||
[self removeTrackingRect:tr->tag];
|
||||
|
||||
// NSLog(@"PCButton: tr: %i data: %@", tr->tag, tr->user_data);
|
||||
|
||||
rect = [self frame];
|
||||
rect.origin.x = 0;
|
||||
rect.origin.y = 0;
|
||||
tag = [self addTrackingRect:rect
|
||||
owner:self
|
||||
userData:string
|
||||
assumeInside:NO];
|
||||
|
||||
if (tr->tag == mainToolTip)
|
||||
{
|
||||
mainToolTip = tag;
|
||||
}
|
||||
|
||||
RELEASE(string);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_invalidateTimer
|
||||
{
|
||||
if (ttTimer == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// NSLog(@"_invalidateTimer");
|
||||
if ([ttTimer isValid])
|
||||
{
|
||||
[ttTimer invalidate];
|
||||
}
|
||||
ttTimer = nil;
|
||||
}
|
||||
|
||||
- (void)_closeToolTipWindow
|
||||
{
|
||||
if (ttWindow)
|
||||
{
|
||||
[ttWindow close];
|
||||
ttWindow = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_drawToolTip:(NSAttributedString *)title
|
||||
{
|
||||
NSRectEdge sides[] = {NSMinXEdge, NSMaxYEdge, NSMaxXEdge, NSMinYEdge};
|
||||
NSColor *black = [NSColor blackColor];
|
||||
NSColor *colors[] = {black, black, black, black};
|
||||
NSRect bounds = [[ttWindow contentView] bounds];
|
||||
NSRect titleRect;
|
||||
|
||||
titleRect = [ttWindow frame];
|
||||
titleRect.origin.x = 2;
|
||||
titleRect.origin.y = -2;
|
||||
|
||||
[[ttWindow contentView] lockFocus];
|
||||
|
||||
[title drawInRect:titleRect];
|
||||
NSDrawColorTiledRects(bounds, bounds, sides, colors, 4);
|
||||
|
||||
[[ttWindow contentView] unlockFocus];
|
||||
}
|
||||
|
||||
- (void)_showTooltip:(NSTimer *)timer
|
||||
{
|
||||
NSString *ttText = [timer userInfo];
|
||||
|
||||
[self _invalidateTimer];
|
||||
|
||||
// NSLog(@"showTooltip: %@", ttText);
|
||||
// NSLog(@"toolTips: %@", toolTips);
|
||||
|
||||
if (ttWindow == nil)
|
||||
{
|
||||
NSAttributedString *attributedTitle = nil;
|
||||
NSSize titleSize;
|
||||
NSPoint mouseLocation = [NSEvent mouseLocation];
|
||||
NSRect windowRect;
|
||||
|
||||
attributedTitle =
|
||||
[[NSAttributedString alloc] initWithString:ttText
|
||||
attributes:ttTitleAttrs];
|
||||
titleSize = [attributedTitle size];
|
||||
|
||||
// Window
|
||||
windowRect = NSMakeRect(mouseLocation.x + 8,
|
||||
mouseLocation.y - 16 - (titleSize.height+3),
|
||||
titleSize.width + 4, titleSize.height + 4);
|
||||
|
||||
ttWindow = [[NSWindow alloc] initWithContentRect:windowRect
|
||||
styleMask:NSBorderlessWindowMask
|
||||
backing:NSBackingStoreRetained
|
||||
defer:YES];
|
||||
[ttWindow setBackgroundColor:ttBackground];
|
||||
[ttWindow setReleasedWhenClosed:YES];
|
||||
[ttWindow setExcludedFromWindowsMenu:YES];
|
||||
[ttWindow setLevel:NSStatusWindowLevel];
|
||||
|
||||
[ttWindow orderFront:nil];
|
||||
|
||||
[self _drawToolTip:attributedTitle];
|
||||
RELEASE(attributedTitle);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ==== Tool Tips
|
||||
// ============================================================================
|
||||
|
||||
/*- (void)mouseEntered:(NSEvent *)theEvent
|
||||
{
|
||||
NSLog (@"mouseEntered");
|
||||
|
||||
if (ttTimer == nil)
|
||||
{
|
||||
ttTimer = [NSTimer scheduledTimerWithTimeInterval:0.5
|
||||
target:self
|
||||
selector:@selector(_showTooltip:)
|
||||
userInfo:[theEvent userData]
|
||||
repeats:YES];
|
||||
[[self window] setAcceptsMouseMovedEvents:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)mouseExited:(NSEvent *)theEvent
|
||||
{
|
||||
// NSLog (@"mouseExited");
|
||||
[self _invalidateTimer];
|
||||
[self _closeToolTipWindow];
|
||||
[[self window] setAcceptsMouseMovedEvents:NO];
|
||||
}
|
||||
|
||||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
// NSLog (@"mouseDown");
|
||||
[self _invalidateTimer];
|
||||
[self _closeToolTipWindow];
|
||||
|
||||
[super mouseDown:theEvent];
|
||||
}
|
||||
|
||||
- (void)mouseMoved:(NSEvent *)theEvent
|
||||
{
|
||||
NSPoint mouseLocation;
|
||||
NSPoint origin;
|
||||
|
||||
// NSLog(@"mouseMoved");
|
||||
if (ttWindow == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mouseLocation = [NSEvent mouseLocation];
|
||||
|
||||
origin = NSMakePoint(mouseLocation.x + 8,
|
||||
mouseLocation.y - 16 - [ttWindow frame].size.height);
|
||||
|
||||
[ttWindow setFrameOrigin:origin];
|
||||
}
|
||||
|
||||
// NSView methods
|
||||
- (NSToolTipTag)addToolTipRect:(NSRect)aRect
|
||||
owner:(id)anObject
|
||||
userData:(void *)data
|
||||
{
|
||||
SEL ownerSelector;
|
||||
NSTrackingRectTag tag;
|
||||
|
||||
if (NSEqualRects(aRect,NSZeroRect) || ttTimer != nil)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
ownerSelector = @selector(view:stringForToolTip:point:userData:);
|
||||
if (![anObject respondsToSelector:ownerSelector]
|
||||
&& ![anObject isKindOfClass:[NSString class]])
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Set rect tracking
|
||||
tag = [self addTrackingRect:aRect
|
||||
owner:self
|
||||
userData:data
|
||||
assumeInside:NO];
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
- (void)removeAllToolTips
|
||||
{
|
||||
int i, j;
|
||||
GSTrackingRect *tr = nil;
|
||||
|
||||
if (_hasTooltips == NO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[self _invalidateTimer];
|
||||
[self _closeToolTipWindow];
|
||||
|
||||
j = [_tracking_rects count];
|
||||
for (i = 0; i < j; i++)
|
||||
{
|
||||
tr = [_tracking_rects objectAtIndex:i];
|
||||
[self removeTrackingRect:tr->tag];
|
||||
}
|
||||
|
||||
mainToolTip = -1;
|
||||
_hasTooltips = NO;
|
||||
}
|
||||
|
||||
- (void)removeToolTip:(NSToolTipTag)tag
|
||||
{
|
||||
[self removeTrackingRect:tag];
|
||||
}
|
||||
|
||||
- (void)setToolTip:(NSString *)string
|
||||
{
|
||||
NSTrackingRectTag tag;
|
||||
NSRect rect;
|
||||
|
||||
if (string == nil) // Remove old tooltip
|
||||
{
|
||||
if (_hasTooltips)
|
||||
{
|
||||
[self _invalidateTimer];
|
||||
[self _closeToolTipWindow];
|
||||
[self removeToolTip:mainToolTip];
|
||||
mainToolTip = -1;
|
||||
_hasTooltips = NO;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// NSLog(@"setToolTip");
|
||||
rect = [self frame];
|
||||
rect.origin.x = 0;
|
||||
rect.origin.y = 0;
|
||||
tag = [self addTrackingRect:rect
|
||||
owner:self
|
||||
userData:string
|
||||
assumeInside:NO];
|
||||
_hasTooltips = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)toolTip
|
||||
{
|
||||
NSEnumerator *enumerator = [_tracking_rects objectEnumerator];
|
||||
GSTrackingRect *tr = nil;
|
||||
|
||||
while ((tr = [enumerator nextObject]))
|
||||
{
|
||||
if (tr->tag == mainToolTip)
|
||||
{
|
||||
return tr->user_data;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}*/
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2002-2004 Free Software Foundation
|
||||
Copyright (C) 2002-2015 Free Software Foundation
|
||||
|
||||
Authors: Philippe C.D. Robert
|
||||
Serg Stoyan
|
||||
Riccardo Mottola
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
|
@ -20,7 +21,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
|
@ -28,8 +29,14 @@
|
|||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCBundleManager.h>
|
||||
#import <ProjectCenter/PCEditorManager.h>
|
||||
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCProjectEditor.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCSaveModified.h>
|
||||
|
||||
#import <Protocols/CodeEditor.h>
|
||||
|
||||
#import "Modules/Preferences/Misc/PCMiscPrefs.h"
|
||||
|
||||
NSString *PCEditorDidChangeFileNameNotification =
|
||||
@"PCEditorDidChangeFileNameNotification";
|
||||
|
@ -99,12 +106,13 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
|
||||
- (void)dealloc
|
||||
{
|
||||
#ifdef DEVELOPMENT
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
NSLog (@"PCEditorManager: dealloc");
|
||||
#endif
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
RELEASE(editorName);
|
||||
RELEASE(_editorsDict);
|
||||
|
||||
[super dealloc];
|
||||
|
@ -118,10 +126,24 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
- (void)setProjectManager:(PCProjectManager *)aProjectManager
|
||||
{
|
||||
_projectManager = aProjectManager;
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(loadPreferences:)
|
||||
name:PCPreferencesDidChangeNotification
|
||||
object:nil];
|
||||
[self loadPreferences:nil];
|
||||
}
|
||||
|
||||
- (void)loadPreferences:(NSNotification *)aNotification
|
||||
{
|
||||
id <PCPreferences> prefs = [_projectManager prefController];
|
||||
|
||||
ASSIGN(editorName, [prefs stringForKey:Editor]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Project and Editor handling
|
||||
// ==== Editor handling
|
||||
// ===========================================================================
|
||||
|
||||
- (id<CodeEditor>)editorForFile:(NSString *)filePath
|
||||
|
@ -136,63 +158,100 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
BOOL isDir;
|
||||
PCBundleManager *bundleManager = [_projectManager bundleManager];
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
NSString *ed = [ud objectForKey:Editor];
|
||||
NSString *fileName = [filePath lastPathComponent];
|
||||
id<CodeEditor> editor;
|
||||
id<CodeParser> parser;
|
||||
BOOL exists = [fm fileExistsAtPath:filePath isDirectory:&isDir];
|
||||
|
||||
NSLog(@"EditorManager: openEditorForFile: \"%@\"", filePath);
|
||||
|
||||
// Determine if file not exist or file is directory
|
||||
if (![fm fileExistsAtPath:filePath isDirectory:&isDir] || isDir)
|
||||
// Determine if file does not exist or file is directory
|
||||
if (!exists)
|
||||
{
|
||||
NSLog(@"%@ doesn't exist!", filePath);
|
||||
NSRunAlertPanel(@"Open Editor",
|
||||
@"Couldn't open editor for file '%@'.\n"
|
||||
@"File doesn't exist.",
|
||||
@"Close", nil, nil, filePath);
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Determine if file is text file
|
||||
if (![[PCFileManager defaultManager] isTextFile:filePath])
|
||||
if(isDir == NO)
|
||||
{
|
||||
NSLog(@"%@ is not plan text file!", filePath);
|
||||
return nil;
|
||||
if (![[PCFileManager defaultManager] isTextFile:filePath] && !isDir)
|
||||
{
|
||||
// TODO: Do not open alert panel for now. Internal editor
|
||||
// for non text files must not be opened. Review PCProjectBrowser.
|
||||
/* NSRunAlertPanel(@"Open Editor",
|
||||
@"Couldn't open editor for file '%@'.\n"
|
||||
@"File is not plain text.",
|
||||
@"Close", nil, nil, filePath);*/
|
||||
PCLogInfo(self, @"Not a text file %@", filePath);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *app;
|
||||
|
||||
/* we don't have in-window editors for any bundles right now */
|
||||
if (!windowed)
|
||||
return nil;
|
||||
|
||||
/* Check for bundles and if possible let them be opened by Workspace but only if windowed */
|
||||
app = [[NSWorkspace sharedWorkspace] getBestAppInRole:@"Editor" forExtension:[fileName pathExtension]];
|
||||
if (windowed && app != nil)
|
||||
{
|
||||
if ([[NSWorkspace sharedWorkspace] openFile: filePath])
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(editor = [_editorsDict objectForKey:filePath]))
|
||||
// NSLog(@"EditorManager 1: %@", _editorsDict);
|
||||
editor = [_editorsDict objectForKey: filePath];
|
||||
if (editor == nil)
|
||||
{
|
||||
NSLog(@"Opening new editor");
|
||||
// Editor
|
||||
editor = [bundleManager objectForBundleWithName:ed
|
||||
type:@"editor"
|
||||
protocol:@protocol(CodeEditor)];
|
||||
editor = [bundleManager objectForBundleWithName:editorName
|
||||
type:@"editor"
|
||||
protocol:@protocol(CodeEditor)];
|
||||
if (editor == nil)
|
||||
{
|
||||
editor = [bundleManager
|
||||
objectForBundleWithName:@"ProjectCenter"
|
||||
type:@"editor"
|
||||
protocol:@protocol(CodeEditor)];
|
||||
return nil;
|
||||
objectForBundleWithName:@"ProjectCenter"
|
||||
type:@"editor"
|
||||
protocol:@protocol(CodeEditor)];
|
||||
}
|
||||
|
||||
// Parser
|
||||
parser = [bundleManager objectForBundleType:@"parser"
|
||||
protocol:@protocol(CodeParser)
|
||||
fileName:fileName];
|
||||
[editor setParser:parser];
|
||||
|
||||
[editor openFileAtPath:filePath
|
||||
editorManager:self
|
||||
editable:editable];
|
||||
|
||||
[_editorsDict setObject:editor forKey:filePath];
|
||||
RELEASE(editor);
|
||||
/* if we have a valid editor, we try to set a parser */
|
||||
if (editor)
|
||||
{
|
||||
// Parser
|
||||
parser = [bundleManager objectForBundleType:@"parser"
|
||||
protocol:@protocol(CodeParser)
|
||||
fileName:fileName];
|
||||
if(parser != nil)
|
||||
{
|
||||
[editor setParser:parser];
|
||||
}
|
||||
[editor openFileAtPath:filePath
|
||||
editorManager:self
|
||||
editable:editable];
|
||||
[_editorsDict setObject:editor forKey:filePath];
|
||||
RELEASE(editor);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// If we don't have an editor, we fall back to opening the
|
||||
// file with the editor designated by the system.
|
||||
//
|
||||
[[NSWorkspace sharedWorkspace] openFile: filePath];
|
||||
}
|
||||
}
|
||||
|
||||
[editor setWindowed:windowed];
|
||||
|
||||
[self orderFrontEditorForFile:filePath];
|
||||
|
||||
NSLog(@"EditorManager: %@", _editorsDict);
|
||||
if(editor != nil)
|
||||
{
|
||||
[editor setWindowed:windowed];
|
||||
}
|
||||
|
||||
return editor;
|
||||
}
|
||||
|
@ -233,7 +292,7 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
return;
|
||||
}
|
||||
|
||||
[_activeEditor closeFile:self save:YES];
|
||||
[_activeEditor close:sender];
|
||||
}
|
||||
|
||||
- (void)closeEditorForFile:(NSString *)file
|
||||
|
@ -242,15 +301,108 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
|
||||
if ([_editorsDict count] > 0 && (editor = [_editorsDict objectForKey:file]))
|
||||
{
|
||||
[editor closeFile:self save:YES];
|
||||
[_editorsDict removeObjectForKey:file];
|
||||
[editor close:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray *)modifiedFiles
|
||||
{
|
||||
NSEnumerator *enumerator = [_editorsDict keyEnumerator];
|
||||
NSString *key = nil;
|
||||
id<CodeEditor> editor;
|
||||
NSMutableArray *modifiedFiles = [[NSMutableArray alloc] init];
|
||||
|
||||
while ((key = [enumerator nextObject]))
|
||||
{
|
||||
editor = [_editorsDict objectForKey:key];
|
||||
if ([editor isEdited])
|
||||
{
|
||||
[modifiedFiles addObject:key];
|
||||
}
|
||||
}
|
||||
|
||||
return AUTORELEASE((NSArray *)modifiedFiles);
|
||||
}
|
||||
|
||||
- (BOOL)hasModifiedFiles
|
||||
{
|
||||
if ([[self modifiedFiles] count])
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)reviewUnsaved:(NSArray *)modifiedFiles
|
||||
{
|
||||
NSEnumerator *enumerator = [modifiedFiles objectEnumerator];
|
||||
NSString *filePath;
|
||||
id<CodeEditor> editor;
|
||||
|
||||
while ((filePath = [enumerator nextObject]))
|
||||
{
|
||||
editor = [_editorsDict objectForKey:filePath];
|
||||
|
||||
[self orderFrontEditorForFile:filePath];
|
||||
|
||||
if ([editor close:self] == NO)
|
||||
{ // Operation should be aborted
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)closeAllEditors
|
||||
{
|
||||
NSArray *modifiedFiles = [self modifiedFiles];
|
||||
|
||||
if ([modifiedFiles count])
|
||||
{
|
||||
if (!PCRunSaveModifiedFilesPanel(self,
|
||||
@"Save and Close",
|
||||
@"Close Anyway",
|
||||
@"Cancel"))
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
[_editorsDict removeAllObjects];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Active editor file handling
|
||||
// ==== File handling
|
||||
// ===========================================================================
|
||||
|
||||
- (BOOL)saveAllFiles
|
||||
{
|
||||
NSEnumerator *enumerator = [_editorsDict keyEnumerator];
|
||||
id<CodeEditor> editor;
|
||||
NSString *key;
|
||||
BOOL ret = YES;
|
||||
|
||||
while ((key = [enumerator nextObject]))
|
||||
{
|
||||
editor = [_editorsDict objectForKey:key];
|
||||
|
||||
if ([editor saveFileIfNeeded] == NO)
|
||||
{
|
||||
ret = NSRunAlertPanel(@"Save Files",
|
||||
@"Couldn't save file '%@'.\n"
|
||||
@"Operation stopped.",
|
||||
@"Ok",nil,nil);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (BOOL)saveFile
|
||||
{
|
||||
id<CodeEditor> editor = [self activeEditor];
|
||||
|
@ -383,5 +535,16 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
[_editorsDict setObject:_editor forKey:_newFileName];
|
||||
}
|
||||
|
||||
- (void)gotoFile: (NSString *)fileName atLine: (NSUInteger)line
|
||||
{
|
||||
PCProject *project = [_projectManager rootActiveProject];
|
||||
PCProjectEditor *pe = [project projectEditor];
|
||||
|
||||
id<CodeEditor> editor = [pe openEditorForFilePath: fileName windowed: NO];
|
||||
|
||||
// [self orderFrontEditorForFile:fileName];
|
||||
[editor scrollToLineNumber: line];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2001-2004 Free Software Foundation
|
||||
Copyright (C) 2001-2015 Free Software Foundation
|
||||
|
||||
Authors: Philippe C.D. Robert
|
||||
Serg Stoyan
|
||||
Riccardo Mottola
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
|
@ -20,15 +21,15 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#include <ProjectCenter/PCFileManager.h>
|
||||
#include <ProjectCenter/PCFileCreator.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCFileManager.h>
|
||||
#import <ProjectCenter/PCFileCreator.h>
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
static PCFileCreator *_creator = nil;
|
||||
static NSDictionary *dict = nil;
|
||||
|
@ -43,53 +44,90 @@ static NSDictionary *dict = nil;
|
|||
NSDictionary *headerDict;
|
||||
NSDictionary *ccDict;
|
||||
NSDictionary *chDict;
|
||||
NSDictionary *classPpDict;
|
||||
NSDictionary *protocolDict;
|
||||
NSDictionary *gsmarkupDict;
|
||||
NSString *descr;
|
||||
NSString *template;
|
||||
NSBundle *bundle;
|
||||
|
||||
_creator = [[[self class] alloc] init];
|
||||
bundle = [NSBundle bundleForClass:[self class]];
|
||||
|
||||
// Setting up the dictionary needed for registration!
|
||||
descr = [NSString stringWithString:@"Generic Objective-C class.\n\nThis is a plain subclass of NSObject which includes only Foundation.h."];
|
||||
classDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
_creator,@"Creator",
|
||||
PCClasses,@"ProjectKey",
|
||||
descr,@"TypeDescription",
|
||||
nil];
|
||||
|
||||
descr = [NSString stringWithString:@"Generic Objective-C header.\n\nThis is a plain interface subclassing NSObject. The file includes Foundation.h"];
|
||||
// Objective C Class
|
||||
descr = @"Generic Objective-C class.\n\n"
|
||||
@"This is a plain subclass of NSObject which includes"
|
||||
@" only Foundation.h.";
|
||||
template = [bundle pathForResource:@"class" ofType:@"template"];
|
||||
classDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
PCClasses, @"ProjectKey",
|
||||
descr, @"TypeDescription",
|
||||
template,@"TemplateFile",
|
||||
nil];
|
||||
|
||||
// Objective C Header
|
||||
descr = @"Generic Objective-C header.\n\n"
|
||||
@"This is a plain interface subclassing NSObject."
|
||||
@" The file includes Foundation.h";
|
||||
template = [bundle pathForResource:@"header" ofType:@"template"];
|
||||
headerDict =[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
_creator,@"Creator",
|
||||
PCHeaders,@"ProjectKey",
|
||||
descr,@"TypeDescription",
|
||||
template,@"TemplateFile",
|
||||
nil];
|
||||
|
||||
descr = [NSString stringWithString:@"Generic ANSI-C implementation file.\n\nThis file contains no Objective-C dependency in any form."];
|
||||
// C File
|
||||
descr = @"Generic ANSI-C implementation file.\n\n"
|
||||
@"This file contains no Objective-C dependency in any form.";
|
||||
template = [bundle pathForResource:@"cfile" ofType:@"template"];
|
||||
ccDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
_creator,@"Creator",
|
||||
PCOtherSources,@"ProjectKey",
|
||||
descr,@"TypeDescription",
|
||||
template,@"TemplateFile",
|
||||
nil];
|
||||
|
||||
descr = [NSString stringWithString:@"Generic ANSI-C header.\n\nThis file contains no Objective-C dependency in any form."];
|
||||
// C Header
|
||||
descr = @"Generic ANSI-C header.\n\n"
|
||||
@"This file contains no Objective-C dependency in any form.";
|
||||
template = [bundle pathForResource:@"cheader" ofType:@"template"];
|
||||
chDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
_creator,@"Creator",
|
||||
PCHeaders,@"ProjectKey",
|
||||
descr,@"TypeDescription",
|
||||
template,@"TemplateFile",
|
||||
nil];
|
||||
|
||||
descr = [NSString stringWithString:@"Generic Objective-C protocol.\n\nThis is common Objective-C protocol, comparable i.e. to a Java interface."];
|
||||
// Objective C Protocol
|
||||
descr = @"Generic Objective-C protocol.\n\n"
|
||||
@"This is common Objective-C protocol, comparable"
|
||||
@" i.e. to a Java interface.";
|
||||
template = [bundle pathForResource:@"protocol" ofType:@"template"];
|
||||
protocolDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
_creator,@"Creator",
|
||||
PCHeaders,@"ProjectKey",
|
||||
descr,@"TypeDescription",
|
||||
template,@"TemplateFile",
|
||||
nil];
|
||||
|
||||
descr = [NSString stringWithString:@"Generic GSMarkup File.\n\nThis is the interface description of GNUstep Renaissance."];
|
||||
// Objective C++ Class
|
||||
descr = @"Generic Objective-C++ class.\n\n"
|
||||
@"This is a plain subclass of NSObject which includes"
|
||||
@" only Foundation.h. Extend it with c++";
|
||||
template = [bundle pathForResource:@"ocppclass" ofType:@"template"];
|
||||
classPpDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
PCClasses, @"ProjectKey",
|
||||
descr, @"TypeDescription",
|
||||
template,@"TemplateFile",
|
||||
nil];
|
||||
|
||||
// GSMarkup
|
||||
descr = @"Generic GSMarkup File.\n\n"
|
||||
@"This is the interface description of GNUstep Renaissance.";
|
||||
template = [bundle pathForResource:@"gsmarkup" ofType:@"template"];
|
||||
gsmarkupDict =[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
_creator,@"Creator",
|
||||
PCGSMarkupFiles,@"ProjectKey",
|
||||
descr,@"TypeDescription",
|
||||
template, @"TemplateFile",
|
||||
nil];
|
||||
|
||||
|
||||
|
@ -99,6 +137,7 @@ static NSDictionary *dict = nil;
|
|||
protocolDict, ProtocolFile,
|
||||
headerDict, ObjCHeader,
|
||||
classDict, ObjCClass,
|
||||
classPpDict, ObjCppClass,
|
||||
gsmarkupDict, GSMarkupFile,
|
||||
nil];
|
||||
}
|
||||
|
@ -134,111 +173,117 @@ static NSDictionary *dict = nil;
|
|||
[self showNewFilePanel];
|
||||
}
|
||||
|
||||
- (NSDictionary *)createFileOfType:(NSString *)type
|
||||
path:(NSString *)path
|
||||
project:(PCProject *)aProject
|
||||
- (void)createFileOfType:(NSString *)fileType
|
||||
path:(NSString *)path
|
||||
project:(PCProject *)project
|
||||
{
|
||||
NSDictionary *newFiles;
|
||||
|
||||
newFiles = [self filesToCreateForFileOfType:fileType
|
||||
path:path
|
||||
withComplementary:YES];
|
||||
|
||||
[self createFiles:newFiles inProject:project];
|
||||
}
|
||||
|
||||
- (NSDictionary *)filesToCreateForFileOfType:(NSString *)type
|
||||
path:(NSString *)path
|
||||
withComplementary:(BOOL)complementary
|
||||
{
|
||||
PCFileManager *pcfm = [PCFileManager defaultManager];
|
||||
NSString *_file = nil;
|
||||
NSString *newFile = nil;
|
||||
NSMutableDictionary *files = nil;
|
||||
NSBundle *bundle = nil;
|
||||
NSString *newFile = nil;
|
||||
|
||||
// A class and possibly a header
|
||||
files = [NSMutableDictionary dictionaryWithCapacity:2];
|
||||
|
||||
PCLogStatus(self, @"create %@ at %@", type, path);
|
||||
|
||||
bundle = [NSBundle bundleForClass:[self class]];
|
||||
newFile = [path copy];
|
||||
|
||||
// Remove file extension from "path"
|
||||
if (![[path pathExtension] isEqualToString: @""])
|
||||
{
|
||||
path = [path stringByDeletingPathExtension];
|
||||
}
|
||||
|
||||
/*
|
||||
* Objective-C Class
|
||||
*/
|
||||
// Objective-C Class
|
||||
if ([type isEqualToString:ObjCClass])
|
||||
{
|
||||
_file = [bundle pathForResource:@"class" ofType:@"template"];
|
||||
newFile = [path stringByAppendingPathExtension:@"m"];
|
||||
[pcfm copyFile:_file toFile:newFile];
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject];
|
||||
[files setObject:ObjCClass forKey:newFile];
|
||||
[files setObject:[dict objectForKey:ObjCClass] forKey:newFile];
|
||||
}
|
||||
|
||||
/*
|
||||
* Objective-C Header
|
||||
* When creating Objective C Class file also create Objective C Header file
|
||||
*/
|
||||
if ([type isEqualToString:ObjCHeader] ||
|
||||
[type isEqualToString:ObjCClass])
|
||||
// Objective-C++ Class
|
||||
else if ([type isEqualToString:ObjCppClass])
|
||||
{
|
||||
_file = [bundle pathForResource:@"header" ofType:@"template"];
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
[pcfm copyFile:_file toFile:newFile];
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject];
|
||||
[files setObject:ObjCHeader forKey:newFile];
|
||||
newFile = [path stringByAppendingPathExtension:@"mm"];
|
||||
[files setObject:[dict objectForKey:ObjCppClass] forKey:newFile];
|
||||
}
|
||||
|
||||
/*
|
||||
* C File
|
||||
*/
|
||||
if ([type isEqualToString:CFile])
|
||||
// C File
|
||||
else if ([type isEqualToString:CFile])
|
||||
{
|
||||
_file = [bundle pathForResource:@"cfile" ofType:@"template"];
|
||||
newFile = [path stringByAppendingPathExtension:@"c"];
|
||||
[pcfm copyFile:_file toFile:newFile];
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject];
|
||||
[files setObject:CFile forKey:newFile];
|
||||
[files setObject:[dict objectForKey:CFile] forKey:newFile];
|
||||
}
|
||||
|
||||
/*
|
||||
* C Header
|
||||
* When creating C file also create C Header file
|
||||
*/
|
||||
// C Header
|
||||
// When creating C file also create C Header file
|
||||
if ([type isEqualToString:CHeader] ||
|
||||
[type isEqualToString:CFile])
|
||||
([type isEqualToString:CFile] && complementary))
|
||||
{
|
||||
_file = [bundle pathForResource:@"cheader" ofType:@"template"];
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
[pcfm copyFile:_file toFile:newFile];
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject];
|
||||
[files setObject:CHeader forKey:newFile];
|
||||
[files setObject:[dict objectForKey:CHeader] forKey:newFile];
|
||||
}
|
||||
/*
|
||||
* GSMarkup
|
||||
*/
|
||||
// Objective-C Header
|
||||
// When creating Objective C Class file also create Objective C Header file
|
||||
else if ([type isEqualToString:ObjCHeader] ||
|
||||
([type isEqualToString:ObjCClass] && complementary))
|
||||
{
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
[files setObject:[dict objectForKey:ObjCHeader] forKey:newFile];
|
||||
}
|
||||
// GSMarkup
|
||||
else if ([type isEqualToString:GSMarkupFile])
|
||||
{
|
||||
_file = [bundle pathForResource:@"gsmarkup" ofType:@"template"];
|
||||
newFile = [path stringByAppendingPathExtension:@"gsmarkup"];
|
||||
[pcfm copyFile:_file toFile:newFile];
|
||||
[files setObject:GSMarkupFile forKey:newFile];
|
||||
[files setObject:[dict objectForKey:GSMarkupFile] forKey:newFile];
|
||||
}
|
||||
/*
|
||||
* Objective-C Protocol
|
||||
*/
|
||||
// Objective-C Protocol
|
||||
else if ([type isEqualToString:ProtocolFile])
|
||||
{
|
||||
_file = [bundle pathForResource:@"protocol" ofType:@"template"];
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
[pcfm copyFile:_file toFile:newFile];
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject];
|
||||
[files setObject:ProtocolFile forKey:newFile];
|
||||
[files setObject:[dict objectForKey:ProtocolFile] forKey:newFile];
|
||||
}
|
||||
|
||||
/*
|
||||
* Notify the browser!
|
||||
*/
|
||||
return files;
|
||||
}
|
||||
|
||||
- (BOOL)createFiles:(NSDictionary *)fileList
|
||||
inProject:(PCProject *)aProject
|
||||
{
|
||||
PCFileManager *pcfm = [PCFileManager defaultManager];
|
||||
NSEnumerator *enumerator = [[fileList allKeys] objectEnumerator];
|
||||
NSString *template = nil;
|
||||
NSString *newFile = nil;
|
||||
NSDictionary *fileType = nil;
|
||||
NSString *key = nil;
|
||||
|
||||
while ((newFile = [enumerator nextObject]))
|
||||
{
|
||||
fileType = [fileList objectForKey:newFile];
|
||||
key = [fileType objectForKey:@"ProjectKey"];
|
||||
template = [fileType objectForKey:@"TemplateFile"];
|
||||
|
||||
if ([pcfm copyFile:template toFile:newFile])
|
||||
{
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject];
|
||||
[aProject addFiles:[NSArray arrayWithObject:newFile]
|
||||
forKey:key
|
||||
notify:YES];
|
||||
}
|
||||
}
|
||||
|
||||
// Notify the browser!
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:@"ProjectDictDidChangeNotification"
|
||||
object:self];
|
||||
|
||||
return files;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)replaceTagsInFileAtPath:(NSString *)newFile
|
||||
|
@ -252,7 +297,13 @@ static NSDictionary *dict = nil;
|
|||
NSString *fn = [aFile stringByDeletingPathExtension];
|
||||
NSRange subRange;
|
||||
|
||||
#ifdef WIN32
|
||||
file = [[NSMutableString stringWithContentsOfFile: newFile
|
||||
encoding: NSUTF8StringEncoding
|
||||
error: NULL] retain];
|
||||
#else
|
||||
file = [[NSMutableString stringWithContentsOfFile:newFile] retain];
|
||||
#endif
|
||||
|
||||
while ((subRange = [file rangeOfString:@"$FULLFILENAME$"]).length)
|
||||
{
|
||||
|
@ -295,8 +346,16 @@ static NSDictionary *dict = nil;
|
|||
withString:[[NSNumber numberWithInt:year] stringValue]];
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
[file writeToFile: newFile
|
||||
atomically: YES
|
||||
encoding: NSUTF8StringEncoding
|
||||
error: NULL];
|
||||
#else
|
||||
[file writeToFile:newFile atomically:YES];
|
||||
[file autorelease];
|
||||
#endif
|
||||
|
||||
[file release];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -321,7 +380,6 @@ static NSDictionary *dict = nil;
|
|||
{
|
||||
[newFilePanel center];
|
||||
}
|
||||
[newFilePanel center];
|
||||
[nfImage setImage:[NSApp applicationIconImage]];
|
||||
[nfTypePB setRefusesFirstResponder:YES];
|
||||
[nfTypePB removeAllItems];
|
||||
|
@ -329,8 +387,9 @@ static NSDictionary *dict = nil;
|
|||
[[dict allKeys]
|
||||
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]];
|
||||
[nfTypePB selectItemAtIndex:0];
|
||||
[nfCancleButton setRefusesFirstResponder:YES];
|
||||
[nfCancelButton setRefusesFirstResponder:YES];
|
||||
[nfCreateButton setRefusesFirstResponder:YES];
|
||||
[nfAddHeaderButton setRefusesFirstResponder:YES];
|
||||
[newFilePanel setDefaultButtonCell:[nfCreateButton cell]];
|
||||
}
|
||||
|
||||
|
@ -339,29 +398,51 @@ static NSDictionary *dict = nil;
|
|||
[newFilePanel makeKeyAndOrderFront:self];
|
||||
[nfNameField setStringValue:@""];
|
||||
[newFilePanel makeFirstResponder:nfNameField];
|
||||
|
||||
[newFilePanel setLevel:NSModalPanelWindowLevel];
|
||||
[NSApp runModalForWindow:newFilePanel];
|
||||
}
|
||||
|
||||
- (void)closeNewFilePanel:(id)sender
|
||||
{
|
||||
[newFilePanel orderOut:self];
|
||||
[NSApp stopModal];
|
||||
|
||||
activeProject = nil;
|
||||
}
|
||||
|
||||
- (void)createFile:(id)sender
|
||||
{
|
||||
[self createFile];
|
||||
[self closeNewFilePanel:self];
|
||||
activeProject = nil;
|
||||
if ([self createFile])
|
||||
{
|
||||
[self closeNewFilePanel:self];
|
||||
}
|
||||
else
|
||||
{
|
||||
[newFilePanel makeKeyAndOrderFront:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)newFilePopupChanged:(id)sender
|
||||
{
|
||||
NSString *type = [sender titleOfSelectedItem];
|
||||
NSDictionary *creator = [dict objectForKey:type];
|
||||
NSString *typeTitle = [sender titleOfSelectedItem];
|
||||
NSDictionary *fileType = [dict objectForKey:typeTitle];
|
||||
|
||||
if (type)
|
||||
if (!fileType)
|
||||
{
|
||||
[nfDescriptionTV setString:[creator objectForKey:@"TypeDescription"]];
|
||||
return;
|
||||
}
|
||||
|
||||
[nfDescriptionTV setString:[fileType objectForKey:@"TypeDescription"]];
|
||||
[nfAddHeaderButton setState:NSOffState];
|
||||
if ([typeTitle isEqualToString:ObjCClass] ||
|
||||
[typeTitle isEqualToString:CFile])
|
||||
{
|
||||
[nfAddHeaderButton setEnabled:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
[nfAddHeaderButton setEnabled:NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,52 +464,70 @@ static NSDictionary *dict = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)createFile
|
||||
- (BOOL)createFile
|
||||
{
|
||||
NSString *path = nil;
|
||||
NSString *fileName = [nfNameField stringValue];
|
||||
NSString *fileType = [nfTypePB titleOfSelectedItem];
|
||||
NSDictionary *fileDict = [dict objectForKey:fileType];
|
||||
NSString *projectKey = [fileDict objectForKey:@"ProjectKey"];
|
||||
|
||||
// PCLogInfo(self, @"[createFile] %@", fileName);
|
||||
|
||||
if ([activeProject doesAcceptFile:fileName forKey:projectKey])
|
||||
{
|
||||
path = [[activeProject projectPath]
|
||||
stringByAppendingPathComponent:fileName];
|
||||
}
|
||||
|
||||
// PCLogInfo(self, @"creating file at %@", path);
|
||||
NSString *fileName = [nfNameField stringValue];
|
||||
NSString *fileType = [nfTypePB titleOfSelectedItem];
|
||||
NSString *path = nil;
|
||||
NSString *key = nil;
|
||||
NSDictionary *newFiles = nil;
|
||||
NSEnumerator *enumerator = nil;
|
||||
NSString *filePath = nil;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
BOOL complementary;
|
||||
|
||||
path = [[activeProject projectPath] stringByAppendingPathComponent:fileName];
|
||||
// Create file
|
||||
if (path)
|
||||
{
|
||||
NSDictionary *newFiles = nil;
|
||||
NSEnumerator *enumerator;
|
||||
NSString *aFile;
|
||||
// Get file list for creation
|
||||
complementary = [nfAddHeaderButton state]==NSOnState ? YES : NO;
|
||||
newFiles = [self filesToCreateForFileOfType:fileType
|
||||
path:path
|
||||
withComplementary:complementary];
|
||||
|
||||
// Do it finally...
|
||||
newFiles = [self createFileOfType:fileType
|
||||
path:path
|
||||
project:activeProject];
|
||||
|
||||
// Add files to a project
|
||||
// Check if project already has files with such names
|
||||
enumerator = [[newFiles allKeys] objectEnumerator];
|
||||
while ((aFile = [enumerator nextObject]))
|
||||
while ((filePath = [enumerator nextObject]))
|
||||
{
|
||||
fileType = [newFiles objectForKey:aFile];
|
||||
fileDict = [dict objectForKey:fileType];
|
||||
projectKey = [fileDict objectForKey:@"ProjectKey"];
|
||||
|
||||
if ([activeProject doesAcceptFile:aFile forKey:projectKey])
|
||||
key = [[newFiles objectForKey:filePath] objectForKey:@"ProjectKey"];
|
||||
fileName = [filePath lastPathComponent];
|
||||
if (![activeProject doesAcceptFile:fileName forKey:key])
|
||||
{
|
||||
[activeProject addFiles:[NSArray arrayWithObject:aFile]
|
||||
forKey:projectKey
|
||||
notify:YES];
|
||||
NSRunAlertPanel(@"New File in Project",
|
||||
@"Project %@ already has file %@ in %@",
|
||||
@"OK", nil, nil,
|
||||
[activeProject projectName], fileName, key);
|
||||
return NO;
|
||||
}
|
||||
if ([fm fileExistsAtPath:filePath])
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = NSRunAlertPanel
|
||||
(@"New File in Project",
|
||||
@"Project directory %@ already has file %@.\n"
|
||||
@"Do you want to overwrite it?",
|
||||
@"Stop", @"Overwrite", nil,
|
||||
[filePath stringByDeletingLastPathComponent],
|
||||
fileName);
|
||||
|
||||
if (ret == NSAlertDefaultReturn) // Stop
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
else // Overwrite. Remove destination of copy operation
|
||||
{
|
||||
[fm removeFileAtPath:filePath handler:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create files
|
||||
return [self createFiles:newFiles inProject:activeProject];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2000-2004 Free Software Foundation
|
||||
Copyright (C) 2000-2022 Free Software Foundation
|
||||
|
||||
Authors: Philippe C.D. Robert
|
||||
Serg Stoyan
|
||||
Riccardo Mottola
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
|
@ -20,18 +21,19 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#include <ProjectCenter/PCFileManager.h>
|
||||
#include <ProjectCenter/PCFileCreator.h>
|
||||
#include <ProjectCenter/PCProjectManager.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#include <ProjectCenter/PCProjectBrowser.h>
|
||||
#include <ProjectCenter/PCAddFilesPanel.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCFileManager.h>
|
||||
#import <ProjectCenter/PCFileCreator.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCProjectBrowser.h>
|
||||
#import <ProjectCenter/PCAddFilesPanel.h>
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <Protocols/Preferences.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
@implementation PCFileManager
|
||||
|
||||
|
@ -105,6 +107,7 @@ static PCFileManager *_mgr = nil;
|
|||
* component any more. Else, you may end up in an infinite loop if
|
||||
* _path = @"".
|
||||
*/
|
||||
isDir = NO;
|
||||
while (_path != nil
|
||||
&& ![_path isEqualToString: _oldPath]
|
||||
&& ![fm fileExistsAtPath:_path isDirectory:&isDir])
|
||||
|
@ -150,13 +153,17 @@ static PCFileManager *_mgr = nil;
|
|||
directoryPath = [toFile stringByDeletingLastPathComponent];
|
||||
if ([self createDirectoriesIfNeededAtPath:directoryPath] == NO)
|
||||
{
|
||||
NSLog(@"PCFileManager: createDirectoriesIfNeededAtPath: == NO");
|
||||
NSRunAlertPanel(@"Copy File",
|
||||
@"Couldn't create directories at path %@",
|
||||
@"Ok",nil,nil, directoryPath);
|
||||
return NO;
|
||||
}
|
||||
|
||||
if ([fm copyPath:file toPath:toFile handler:self] == NO)
|
||||
{
|
||||
NSLog(@"PCFileManager: copyPath:toPath: == NO");
|
||||
NSRunAlertPanel(@"Copy File",
|
||||
@"Couldn't copy file %@ to %@",
|
||||
@"Ok",nil,nil, file, toFile);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +183,7 @@ static PCFileManager *_mgr = nil;
|
|||
path = [directory stringByAppendingPathComponent:[file lastPathComponent]];
|
||||
|
||||
if (![self copyFile:file toFile:path])
|
||||
{
|
||||
{ // No need to open aler panel here
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -234,6 +241,9 @@ static PCFileManager *_mgr = nil;
|
|||
{
|
||||
if ([fm removeFileAtPath:path handler:nil] == NO)
|
||||
{
|
||||
NSRunAlertPanel(@"Remove Directory",
|
||||
@"Couldn't remove empty directory at path %@",
|
||||
@"Ok",nil,nil, path);
|
||||
return NO;
|
||||
}
|
||||
path = [path stringByDeletingLastPathComponent];
|
||||
|
@ -257,7 +267,9 @@ static PCFileManager *_mgr = nil;
|
|||
path = [directory stringByAppendingPathComponent:file];
|
||||
if (![fm removeFileAtPath:path handler:nil])
|
||||
{
|
||||
NSLog(@"PCFileManager: removeFileAtPath: == NO");
|
||||
NSRunAlertPanel(@"Remove File",
|
||||
@"Couldn't remove file at path %@",
|
||||
@"Ok",nil,nil, path);
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -310,12 +322,48 @@ static PCFileManager *_mgr = nil;
|
|||
}
|
||||
else
|
||||
{
|
||||
NSRunAlertPanel(@"Move File",
|
||||
@"Couldn't move file %@ to %@",
|
||||
@"Ok",nil,nil, file, directory);
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Find Executable
|
||||
// Tries to find the first matching executable tool fromt he given, nil-terminated
|
||||
// list. Returns the full path for it.
|
||||
// ===========================================================================
|
||||
- (NSString*) findExecutableToolFrom: (NSArray*)candidates
|
||||
{
|
||||
NSFileManager *manager;
|
||||
NSEnumerator *pathEnumerator;
|
||||
NSString *directory;
|
||||
|
||||
manager = [NSFileManager defaultManager];
|
||||
pathEnumerator = [NSSearchPathForDirectoriesInDomains(NSDeveloperDirectory, NSAllDomainsMask, YES) objectEnumerator];
|
||||
|
||||
while (nil != (directory = [pathEnumerator nextObject]))
|
||||
{
|
||||
NSEnumerator *candidateEnumerator = [candidates objectEnumerator];
|
||||
NSString *candidate;
|
||||
|
||||
while (nil != (candidate = [candidateEnumerator nextObject]))
|
||||
{
|
||||
NSString *path = [directory stringByAppendingPathComponent: candidate];
|
||||
|
||||
if ([manager isExecutableFileAtPath: path])
|
||||
{
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCFileManager (UInterface)
|
||||
|
@ -328,9 +376,9 @@ static PCFileManager *_mgr = nil;
|
|||
title:(NSString *)title
|
||||
accView:(NSView *)accessoryView
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
NSString *lastOpenDir;
|
||||
id panel;
|
||||
id <PCPreferences> prefs = [projectManager prefController];
|
||||
NSString *lastOpenDir;
|
||||
id panel;
|
||||
|
||||
operation = op;
|
||||
|
||||
|
@ -340,26 +388,39 @@ static PCFileManager *_mgr = nil;
|
|||
panel = [NSOpenPanel openPanel];
|
||||
[panel setCanChooseFiles:YES];
|
||||
[panel setCanChooseDirectories:NO];
|
||||
lastOpenDir = [ud objectForKey:@"FileOpenLastDirectory"];
|
||||
lastOpenDir = [prefs stringForKey:@"FileOpenLastDirectory"];
|
||||
break;
|
||||
case PCSaveFileOperation:
|
||||
panel = [NSSavePanel savePanel];
|
||||
lastOpenDir = [ud objectForKey:@"FileSaveLastDirectory"];
|
||||
lastOpenDir = [prefs stringForKey:@"FileSaveLastDirectory"];
|
||||
break;
|
||||
case PCOpenProjectOperation:
|
||||
panel = [NSOpenPanel openPanel];
|
||||
[panel setAllowsMultipleSelection:NO];
|
||||
[panel setCanChooseFiles:YES];
|
||||
[panel setCanChooseDirectories:YES];
|
||||
lastOpenDir = [ud objectForKey:@"ProjectOpenLastDirectory"];
|
||||
lastOpenDir = [prefs stringForKey:@"ProjectOpenLastDirectory"];
|
||||
break;
|
||||
case PCOpenDirectoryOperation:
|
||||
panel = [NSOpenPanel openPanel];
|
||||
[panel setCanChooseFiles:NO];
|
||||
[panel setCanChooseDirectories:YES];
|
||||
lastOpenDir = [prefs stringForKey:@"FileOpenLastDirectory"];
|
||||
break;
|
||||
case PCAddFileOperation:
|
||||
if (addFilesPanel == nil)
|
||||
{
|
||||
addFilesPanel = [PCAddFilesPanel addFilesPanel];
|
||||
[addFilesPanel setTreatsFilePackagesAsDirectories: YES];
|
||||
}
|
||||
panel = addFilesPanel;
|
||||
lastOpenDir = [ud objectForKey:@"FileAddLastDirectory"];
|
||||
lastOpenDir = [prefs stringForKey:@"FileAddLastDirectory"];
|
||||
if (lastOpenDir == nil)
|
||||
{
|
||||
PCProject *pr = [projectManager activeProject];
|
||||
NSString *prPathRoot = [pr projectPath];
|
||||
lastOpenDir = prPathRoot;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return nil;
|
||||
|
@ -388,8 +449,8 @@ static PCFileManager *_mgr = nil;
|
|||
|
||||
- (void)_saveLastDirectoryForPanel:(id)panel
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
NSString *key = nil;
|
||||
id <PCPreferences> prefs = [projectManager prefController];
|
||||
NSString *key = nil;
|
||||
|
||||
switch (operation)
|
||||
{
|
||||
|
@ -411,7 +472,7 @@ static PCFileManager *_mgr = nil;
|
|||
|
||||
if (key != nil)
|
||||
{
|
||||
[ud setObject:[panel directory] forKey:key];
|
||||
[prefs setString:[panel directory] forKey:key notify:NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -423,28 +484,21 @@ static PCFileManager *_mgr = nil;
|
|||
{
|
||||
id panel;
|
||||
NSMutableArray *fileList = [[NSMutableArray alloc] init];
|
||||
NSString *file;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
BOOL isDir;
|
||||
int result;
|
||||
int result = -10;
|
||||
|
||||
panel = [self _panelForOperation:op title:title accView:accessoryView];
|
||||
|
||||
if ((op == PCOpenFileOperation) || (op == PCOpenProjectOperation))
|
||||
if (types != nil)
|
||||
{
|
||||
[panel setAllowsMultipleSelection:yn];
|
||||
[panel setAllowedFileTypes:types];
|
||||
}
|
||||
|
||||
if ((op == PCOpenFileOperation) ||
|
||||
(op == PCOpenProjectOperation) ||
|
||||
(op == PCOpenDirectoryOperation))
|
||||
{
|
||||
if ((result = [panel runModalForTypes:types]) == NSOKButton)
|
||||
{
|
||||
[fileList addObjectsFromArray:[panel filenames]];
|
||||
|
||||
file = [fileList objectAtIndex:0];
|
||||
if (op == PCOpenProjectOperation &&
|
||||
[fm fileExistsAtPath:file isDirectory:&isDir] && isDir)
|
||||
{
|
||||
file = [file stringByAppendingPathComponent:@"PC.project"];
|
||||
[fileList insertObject:file atIndex:0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (op == PCSaveFileOperation)
|
||||
|
@ -549,17 +603,26 @@ static PCFileManager *_mgr = nil;
|
|||
{
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
BOOL isDir;
|
||||
NSString *file;
|
||||
NSEnumerator *e = nil;
|
||||
NSArray *tempList = nil;
|
||||
NSString *tempExtension = nil;
|
||||
|
||||
if (operation == PCOpenProjectOperation)
|
||||
{
|
||||
if ([fm fileExistsAtPath:filename isDirectory:&isDir] && isDir)
|
||||
{
|
||||
file = [filename stringByAppendingPathComponent:@"PC.project"];
|
||||
if ([fm fileExistsAtPath:file])
|
||||
e = [[sender allowedFileTypes] objectEnumerator];
|
||||
while ((tempExtension = [e nextObject]) != nil)
|
||||
{
|
||||
return YES;
|
||||
tempList = [self filesWithExtension:tempExtension
|
||||
atPath:filename
|
||||
includeDirs:YES];
|
||||
if ([tempList count] > 0)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
@ -569,7 +632,7 @@ static PCFileManager *_mgr = nil;
|
|||
|
||||
@end
|
||||
|
||||
@implementation PCFileManager (FileType)
|
||||
@implementation PCFileManager (Misc)
|
||||
|
||||
/**
|
||||
* Returns YES if the file identified by `filename' is a text file,
|
||||
|
@ -585,9 +648,11 @@ static PCFileManager *_mgr = nil;
|
|||
{
|
||||
NSFileHandle *fh;
|
||||
NSData *data;
|
||||
unsigned int i, n;
|
||||
const char *buf;
|
||||
unsigned int printable;
|
||||
NSUInteger i, printable = 0;
|
||||
NSString *content;
|
||||
NSCharacterSet *alpha = [NSCharacterSet alphanumericCharacterSet];
|
||||
NSCharacterSet *spaces = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||
NSCharacterSet *marks = [NSCharacterSet punctuationCharacterSet];
|
||||
|
||||
fh = [NSFileHandle fileHandleForReadingAtPath:filename];
|
||||
if (fh == nil)
|
||||
|
@ -601,16 +666,45 @@ static PCFileManager *_mgr = nil;
|
|||
return YES;
|
||||
}
|
||||
|
||||
buf = [data bytes];
|
||||
for (i = printable = 0, n = [data length]; i < n; i++)
|
||||
content = [NSString stringWithContentsOfFile: filename];
|
||||
for (i = 0; i < [content length]; i++)
|
||||
{
|
||||
if (isprint(buf[i]) || isspace(buf[i]))
|
||||
if ([alpha characterIsMember: [content characterAtIndex: i]] ||
|
||||
[spaces characterIsMember: [content characterAtIndex: i]] ||
|
||||
[marks characterIsMember: [content characterAtIndex: i]])
|
||||
{
|
||||
printable++;
|
||||
}
|
||||
}
|
||||
|
||||
return (((double) printable / n) > 0.9);
|
||||
return (((double) printable / i) > 0.9);
|
||||
}
|
||||
|
||||
- (NSArray *)filesWithExtension:(NSString *)extension
|
||||
atPath:(NSString *)dirPath
|
||||
includeDirs:(BOOL)incDirs
|
||||
{
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSMutableArray *filesList = [[NSMutableArray alloc] init];
|
||||
NSEnumerator *e = nil;
|
||||
NSString *temp = nil;
|
||||
BOOL isDir;
|
||||
|
||||
e = [[fm directoryContentsAtPath:dirPath] objectEnumerator];
|
||||
while ((temp = [e nextObject]) != nil)
|
||||
{
|
||||
if ([fm fileExistsAtPath:temp isDirectory:&isDir] && isDir && !incDirs)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ([[temp pathExtension] isEqual:extension])
|
||||
{
|
||||
[filesList addObject:[dirPath stringByAppendingPathComponent:temp]];
|
||||
}
|
||||
}
|
||||
|
||||
return [filesList autorelease];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#include <ProjectCenter/PCFileNameField.h>
|
||||
#import <ProjectCenter/PCFileNameField.h>
|
||||
|
||||
NSString *PCFileNameFieldNoFiles = @"No files selected";
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
@ -33,7 +33,9 @@
|
|||
- (void)awakeFromNib
|
||||
{
|
||||
filePath = nil;
|
||||
[self setImage:[NSImage imageNamed:@"ProjectCenter"]];
|
||||
[self setRefusesFirstResponder:YES];
|
||||
// [self setEditable:NO]; // prevents dragging
|
||||
// [self setImage:[NSImage imageNamed:@"ProjectCenter"]];
|
||||
[self
|
||||
registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
|
||||
}
|
||||
|
@ -44,15 +46,15 @@
|
|||
|
||||
filePath = nil;
|
||||
[self setRefusesFirstResponder:YES];
|
||||
[self setEditable:NO];
|
||||
[self setImage:[NSImage imageNamed:@"ProjectCenter"]];
|
||||
// [self setEditable:NO]; // prevents dragging
|
||||
// [self setImage:[NSImage imageNamed:@"ProjectCenter"]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
#ifdef DEVELOPMENT
|
||||
#ifdef DEBUG
|
||||
NSLog (@"PCFileNameIcon: dealloc");
|
||||
#endif
|
||||
|
||||
|
@ -60,6 +62,7 @@
|
|||
|
||||
RELEASE(fileNameField);
|
||||
RELEASE(delegate);
|
||||
RELEASE(filePath);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -71,7 +74,7 @@
|
|||
|
||||
- (void)setDelegate:(id)object
|
||||
{
|
||||
delegate = object;
|
||||
ASSIGN(delegate, object);
|
||||
}
|
||||
|
||||
- (void)updateIcon
|
||||
|
@ -82,24 +85,54 @@
|
|||
{
|
||||
[self setImage:[delegate fileNameIconImage]];
|
||||
}
|
||||
if ([delegate respondsToSelector:@selector(fileNameIconTitle)])
|
||||
if ((fileNameField != nil) &&
|
||||
[delegate respondsToSelector:@selector(fileNameIconTitle)])
|
||||
{
|
||||
[fileNameField setStringValue:[delegate fileNameIconTitle]];
|
||||
}
|
||||
if ([delegate respondsToSelector:@selector(fileNameIconPath)])
|
||||
{
|
||||
ASSIGN(filePath, [delegate fileNameIconPath]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Drag and drop
|
||||
|
||||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
NSArray *fileList = [NSArray arrayWithObjects:filePath, nil];
|
||||
NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
|
||||
NSPoint dragPosition;
|
||||
|
||||
[pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType]
|
||||
owner:nil];
|
||||
[pboard setPropertyList:fileList forType:NSFilenamesPboardType];
|
||||
|
||||
// Start the drag operation
|
||||
dragPosition = [self convertPoint:[theEvent locationInWindow]
|
||||
fromView:nil];
|
||||
dragPosition.x -= 16;
|
||||
dragPosition.y -= 16;
|
||||
|
||||
[self dragImage:[self image]
|
||||
at:dragPosition
|
||||
offset:NSZeroSize
|
||||
event:theEvent
|
||||
pasteboard:pboard
|
||||
source:self
|
||||
slideBack:YES];
|
||||
}
|
||||
|
||||
// --- NSDraggingDestination protocol methods
|
||||
// -- Before the image is released
|
||||
- (unsigned int)draggingEntered:(id <NSDraggingInfo>)sender
|
||||
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
NSPasteboard *pb = [sender draggingPasteboard];
|
||||
NSArray *paths = [pb propertyListForType:NSFilenamesPboardType];
|
||||
unsigned int draggingOp = NSDragOperationNone;
|
||||
NSDragOperation draggingOp = NSDragOperationNone;
|
||||
|
||||
NSLog(@"Dragging entered");
|
||||
// NSLog(@"Dragging entered: %@", paths);
|
||||
|
||||
if (![paths isKindOfClass:[NSArray class]] || [paths count] == 0)
|
||||
{
|
||||
|
@ -122,12 +155,22 @@
|
|||
|
||||
- (void)draggingExited:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
NSLog(@"Dragging exited");
|
||||
}
|
||||
|
||||
// -- After the image is released
|
||||
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
NSPasteboard *pb = [sender draggingPasteboard];
|
||||
NSArray *paths = [pb propertyListForType:NSFilenamesPboardType];
|
||||
|
||||
NSLog(@"Prepare for drag operation");
|
||||
|
||||
if (delegate &&
|
||||
[delegate respondsToSelector:@selector(prepareForDraggingOf:)])
|
||||
{
|
||||
return [delegate prepareForDraggingOf:paths];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -138,11 +181,34 @@
|
|||
|
||||
NSLog(@"performDragOperation: %@", paths);
|
||||
|
||||
return NO;
|
||||
if (delegate &&
|
||||
[delegate respondsToSelector:@selector(performDraggingOf:)])
|
||||
{
|
||||
return [delegate performDraggingOf:paths];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)concludeDragOperation:(id <NSDraggingInfo>)sendera
|
||||
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
NSPasteboard *pb = [sender draggingPasteboard];
|
||||
NSArray *paths = [pb propertyListForType:NSFilenamesPboardType];
|
||||
|
||||
NSLog(@"Conclude drag operation");
|
||||
|
||||
if (delegate &&
|
||||
[delegate respondsToSelector:@selector(concludeDraggingOf:)])
|
||||
{
|
||||
[delegate concludeDraggingOf:paths];
|
||||
}
|
||||
}
|
||||
|
||||
// --- NSDraggingSource protocol methods
|
||||
|
||||
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
|
||||
{
|
||||
return NSDragOperationCopy;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
@ -114,7 +114,7 @@ static PCLogController *_logCtrllr = nil;
|
|||
[panel center];
|
||||
}
|
||||
|
||||
font = [NSFont userFixedPitchFontOfSize: 10.0];
|
||||
font = [NSFont userFixedPitchFontOfSize:[NSFont systemFontSize]];
|
||||
textAttributes =
|
||||
[NSMutableDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
|
||||
[textAttributes retain];
|
||||
|
@ -134,7 +134,7 @@ static PCLogController *_logCtrllr = nil;
|
|||
|
||||
- (void)showPanel
|
||||
{
|
||||
[panel orderFront:self];
|
||||
[panel makeKeyAndOrderFront:self];
|
||||
}
|
||||
|
||||
- (void)logMessage:(NSString *)text withTag:(int)tag sender:(id)sender;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2002-2004 Free Software Foundation
|
||||
Copyright (C) 2002-2014 Free Software Foundation
|
||||
|
||||
Authors: Philippe C.D. Robert
|
||||
Serg Stoyan
|
||||
Riccardo Mottola
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
|
@ -20,16 +21,21 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#include <ProjectCenter/PCMakefileFactory.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCMakefileFactory.h>
|
||||
|
||||
#import <Protocols/Preferences.h>
|
||||
#import "../Modules/Preferences/Build/PCBuildPrefs.h"
|
||||
|
||||
#define COMMENT_HEADERS @"\n\n#\n# Header files\n#\n"
|
||||
#define COMMENT_RESOURCES @"\n\n#\n# Resource files\n#\n"
|
||||
#define COMMENT_CLASSES @"\n\n#\n# Class files\n#\n"
|
||||
#define COMMENT_CLASSES @"\n\n#\n# Objective-C Class files\n#\n"
|
||||
#define COMMENT_OCPPCLASSES @"\n\n#\n# Objective-C++ Class files\n#\n"
|
||||
#define COMMENT_CFILES @"\n\n#\n# Other sources\n#\n"
|
||||
#define COMMENT_SUBPROJECTS @"\n\n#\n# Subprojects\n#\n"
|
||||
#define COMMENT_APP @"\n\n#\n# Main application\n#\n"
|
||||
|
@ -47,7 +53,7 @@ static PCMakefileFactory *_factory = nil;
|
|||
{
|
||||
static BOOL isInitialised = NO;
|
||||
|
||||
if( isInitialised == NO )
|
||||
if (isInitialised == NO)
|
||||
{
|
||||
_factory = [[PCMakefileFactory alloc] init];
|
||||
|
||||
|
@ -57,13 +63,13 @@ static PCMakefileFactory *_factory = nil;
|
|||
return _factory;
|
||||
}
|
||||
|
||||
- (void)createMakefileForProject:(PCProject *)project
|
||||
- (void) createMakefileForProject: (PCProject *)project
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
NSString *buildDir = [ud objectForKey:RootBuildDirectory];
|
||||
id <PCPreferences> prefs = [[project projectManager] prefController];
|
||||
NSString *buildDir = [prefs stringForKey:RootBuildDirectory];
|
||||
NSString *prName = [project projectName];
|
||||
NSString *buildName = [prName stringByAppendingPathExtension:@"build"];
|
||||
NSString *instDir = [[project projectDict] objectForKey:PCInstallDir];
|
||||
NSString *buildName = [prName stringByAppendingPathExtension: @"build"];
|
||||
NSString *instDomain = [[project projectDict] objectForKey:PCInstallDomain];
|
||||
|
||||
NSAssert(prName, @"No project name given!");
|
||||
|
||||
|
@ -73,32 +79,52 @@ static PCMakefileFactory *_factory = nil;
|
|||
AUTORELEASE(pnme);
|
||||
pnme = [prName copy];
|
||||
|
||||
[mfile appendString:@"#\n"];
|
||||
[mfile appendString:@"# GNUmakefile - Generated by ProjectCenter\n"];
|
||||
[mfile appendString:@"#\n"];
|
||||
[mfile appendString: @"#\n"];
|
||||
[mfile appendString: @"# GNUmakefile - Generated by ProjectCenter\n"];
|
||||
[mfile appendString: @"#\n"];
|
||||
|
||||
if ([instDir isEqualToString:@"LOCAL"] ||
|
||||
[instDir isEqualToString:@"SYSTEM"] ||
|
||||
[instDir isEqualToString:@"USER"] ||
|
||||
[instDir isEqualToString:@"NETWORK"])
|
||||
[mfile appendString: @"ifeq ($(GNUSTEP_MAKEFILES),)\n"];
|
||||
[mfile appendString: @" GNUSTEP_MAKEFILES := $(shell gnustep-config "];
|
||||
[mfile appendString: @"--variable=GNUSTEP_MAKEFILES 2>/dev/null)\n"];
|
||||
[mfile appendString: @" ifeq ($(GNUSTEP_MAKEFILES),)\n"];
|
||||
[mfile appendString: @" $(warning )\n"];
|
||||
[mfile appendString: @" $(warning Unable to obtain GNUSTEP_MAKEFILES"];
|
||||
[mfile appendString: @" setting from gnustep-config!)\n"];
|
||||
[mfile appendString: @" $(warning Perhaps gnustep-make is not properly"];
|
||||
[mfile appendString: @" installed,)\n"];
|
||||
[mfile appendString: @" $(warning so gnustep-config is not in your"];
|
||||
[mfile appendString: @" PATH.)\n"];
|
||||
[mfile appendString: @" $(warning )\n"];
|
||||
[mfile appendString: @" $(warning Your PATH is currently $(PATH))\n"];
|
||||
[mfile appendString: @" $(warning )\n"];
|
||||
[mfile appendString: @" endif\n"];
|
||||
[mfile appendString: @"endif\n"];
|
||||
[mfile appendString: @"ifeq ($(GNUSTEP_MAKEFILES),)\n"];
|
||||
[mfile appendString: @" $(error You need to set GNUSTEP_MAKEFILES"];
|
||||
[mfile appendString: @" before compiling!)\n"];
|
||||
[mfile appendString: @"endif\n"];
|
||||
|
||||
if ([instDomain isEqualToString: @"LOCAL"]
|
||||
|| [instDomain isEqualToString: @"SYSTEM"]
|
||||
|| [instDomain isEqualToString: @"USER"]
|
||||
|| [instDomain isEqualToString: @"NETWORK"])
|
||||
{
|
||||
[mfile appendString:
|
||||
[NSString stringWithFormat:@"\nGNUSTEP_INSTALLATION_DOMAIN = %@\n",
|
||||
instDir]];
|
||||
}
|
||||
else if ([instDir isEqualToString:@""])
|
||||
{
|
||||
[mfile appendString:
|
||||
[NSString stringWithFormat:@"\nGNUSTEP_INSTALLATION_DOMAIN = LOCAL\n",
|
||||
instDir]];
|
||||
[NSString stringWithFormat: @"\nGNUSTEP_INSTALLATION_DOMAIN = %@\n",
|
||||
instDomain]];
|
||||
}
|
||||
|
||||
[mfile appendString:@"\ninclude $(GNUSTEP_MAKEFILES)/common.make\n"];
|
||||
/* If GNUSTEP_INSTALLATION_DOMAIN was not set explicitly by the
|
||||
* user, it should not be specified; gnustep-make will use the
|
||||
* default - normally, but not necessarily, LOCAL.
|
||||
*/
|
||||
|
||||
if (![buildDir isEqualToString:@""])
|
||||
[mfile appendString: @"\ninclude $(GNUSTEP_MAKEFILES)/common.make\n"];
|
||||
|
||||
if (![buildDir isEqualToString: @""] && buildDir != nil)
|
||||
{
|
||||
[mfile appendString:
|
||||
[NSString stringWithFormat:@"\nGNUSTEP_BUILD_DIR = %@\n",
|
||||
[NSString stringWithFormat: @"\nGNUSTEP_BUILD_DIR = %@\n",
|
||||
[buildDir stringByAppendingPathComponent:buildName]]];
|
||||
}
|
||||
}
|
||||
|
@ -113,39 +139,39 @@ static PCMakefileFactory *_factory = nil;
|
|||
NSString *projectType = [project projectTypeName];
|
||||
|
||||
// Create the new file
|
||||
[mfp appendString:@"#\n"];
|
||||
[mfp appendString:@"# GNUmakefile.preamble - Generated by ProjectCenter\n"];
|
||||
[mfp appendString:@"#\n\n"];
|
||||
[mfp appendString: @"#\n"];
|
||||
[mfp appendString: @"# GNUmakefile.preamble - Generated by ProjectCenter\n"];
|
||||
[mfp appendString: @"#\n\n"];
|
||||
|
||||
// Preprocessor flags
|
||||
[mfp appendString:@"# Additional flags to pass to the preprocessor\n"];
|
||||
[mfp appendString: @"# Additional flags to pass to the preprocessor\n"];
|
||||
[mfp appendString:
|
||||
[NSString stringWithFormat:@"ADDITIONAL_CPPFLAGS += %@\n\n",
|
||||
[NSString stringWithFormat: @"ADDITIONAL_CPPFLAGS += %@\n\n",
|
||||
[projectDict objectForKey:PCPreprocessorOptions]]];
|
||||
|
||||
// Objective C compiler flags
|
||||
[mfp appendString:@"# Additional flags to pass to Objective C compiler\n"];
|
||||
[mfp appendString: @"# Additional flags to pass to Objective C compiler\n"];
|
||||
[mfp appendString:
|
||||
[NSString stringWithFormat:@"ADDITIONAL_OBJCFLAGS += %@\n\n",
|
||||
[NSString stringWithFormat: @"ADDITIONAL_OBJCFLAGS += %@\n\n",
|
||||
[projectDict objectForKey:PCObjCCompilerOptions]]];
|
||||
|
||||
// C compiler flags
|
||||
[mfp appendString:@"# Additional flags to pass to C compiler\n"];
|
||||
[mfp appendString: @"# Additional flags to pass to C compiler\n"];
|
||||
[mfp appendString:
|
||||
[NSString stringWithFormat:@"ADDITIONAL_CFLAGS += %@\n\n",
|
||||
[NSString stringWithFormat: @"ADDITIONAL_CFLAGS += %@\n\n",
|
||||
[projectDict objectForKey:PCCompilerOptions]]];
|
||||
|
||||
// Linker flags
|
||||
[mfp appendString:@"# Additional flags to pass to the linker\n"];
|
||||
[mfp appendString: @"# Additional flags to pass to the linker\n"];
|
||||
[mfp appendString:
|
||||
[NSString stringWithFormat:@"ADDITIONAL_LDFLAGS += %@ ",
|
||||
[NSString stringWithFormat: @"ADDITIONAL_LDFLAGS += %@ ",
|
||||
[projectDict objectForKey:PCLinkerOptions]]];
|
||||
[mfp appendString:@"\n\n"];
|
||||
[mfp appendString: @"\n\n"];
|
||||
|
||||
// Directories where to search headers
|
||||
[mfp appendString:
|
||||
@"# Additional include directories the compiler should search\n"];
|
||||
[mfp appendString:@"ADDITIONAL_INCLUDE_DIRS += "];
|
||||
[mfp appendString: @"ADDITIONAL_INCLUDE_DIRS += "];
|
||||
array = [projectDict objectForKey:PCSearchHeaders];
|
||||
if (array && [array count])
|
||||
{
|
||||
|
@ -154,15 +180,15 @@ static PCMakefileFactory *_factory = nil;
|
|||
|
||||
while ((tmp = [enumerator nextObject]))
|
||||
{
|
||||
[mfp appendString:[NSString stringWithFormat:@"-I%@ ",tmp]];
|
||||
[mfp appendString: [NSString stringWithFormat: @"-I%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
[mfp appendString:@"\n\n"];
|
||||
[mfp appendString: @"\n\n"];
|
||||
|
||||
// Directories where to search libraries
|
||||
[mfp appendString:
|
||||
@"# Additional library directories the linker should search\n"];
|
||||
[mfp appendString:@"ADDITIONAL_LIB_DIRS += "];
|
||||
[mfp appendString: @"ADDITIONAL_LIB_DIRS += "];
|
||||
array = [projectDict objectForKey:PCSearchLibs];
|
||||
if (array && [array count])
|
||||
{
|
||||
|
@ -171,17 +197,17 @@ static PCMakefileFactory *_factory = nil;
|
|||
|
||||
while ((tmp = [enumerator nextObject]))
|
||||
{
|
||||
[mfp appendString:[NSString stringWithFormat:@"-L%@ ",tmp]];
|
||||
[mfp appendString: [NSString stringWithFormat: @"-L%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
[mfp appendString:@"\n\n"];
|
||||
[mfp appendString: @"\n\n"];
|
||||
|
||||
// [mfp appendString:[projectDict objectForKey:PCLibraries]];
|
||||
// [mfp appendString: [projectDict objectForKey:PCLibraries]];
|
||||
|
||||
if([projectType isEqualToString: @"Tool"])
|
||||
if ([projectType isEqualToString: @"Tool"])
|
||||
{
|
||||
// Additional TOOL libraries
|
||||
[mfp appendString:@"# Additional TOOL libraries to link\n"];
|
||||
[mfp appendString: @"# Additional TOOL libraries to link\n"];
|
||||
[mfp appendString: @"ADDITIONAL_TOOL_LIBS += "];
|
||||
array = [projectDict objectForKey:PCLibraries];
|
||||
if (array && [array count])
|
||||
|
@ -191,9 +217,9 @@ static PCMakefileFactory *_factory = nil;
|
|||
|
||||
while ((tmp = [enumerator nextObject]))
|
||||
{
|
||||
if (![tmp isEqualToString:@"gnustep-base"])
|
||||
if (![tmp isEqualToString: @"gnustep-base"])
|
||||
{
|
||||
[mfp appendString:[NSString stringWithFormat:@"-l%@ ",tmp]];
|
||||
[mfp appendString: [NSString stringWithFormat: @"-l%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +229,7 @@ static PCMakefileFactory *_factory = nil;
|
|||
// Additional GUI libraries
|
||||
// TODO: Let the user select objc, base, gui libraries/frameworks
|
||||
// on the gui - the following works well for GUI stuff only.
|
||||
[mfp appendString:@"# Additional GUI libraries to link\n"];
|
||||
[mfp appendString: @"# Additional GUI libraries to link\n"];
|
||||
[mfp appendString: @"ADDITIONAL_GUI_LIBS += "];
|
||||
array = [projectDict objectForKey:PCLibraries];
|
||||
if (array && [array count])
|
||||
|
@ -213,25 +239,28 @@ static PCMakefileFactory *_factory = nil;
|
|||
|
||||
while ((tmp = [enumerator nextObject]))
|
||||
{
|
||||
if (![tmp isEqualToString:@"gnustep-base"] &&
|
||||
![tmp isEqualToString:@"gnustep-gui"])
|
||||
if (![tmp isEqualToString: @"gnustep-base"] &&
|
||||
![tmp isEqualToString: @"gnustep-gui"])
|
||||
{
|
||||
[mfp appendString:[NSString stringWithFormat:@"-l%@ ",tmp]];
|
||||
[mfp appendString: [NSString stringWithFormat: @"-l%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[mfp appendString:@"\n\n"];
|
||||
[mfp appendString: @"\n\n"];
|
||||
|
||||
// Write the new file to disc!
|
||||
mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile.preamble"];
|
||||
if ([mfp writeToFile:mfl atomically:YES])
|
||||
mfl = [projectPath stringByAppendingPathComponent: @"GNUmakefile.preamble"];
|
||||
if (![mfp writeToFile:mfl atomically:YES])
|
||||
{
|
||||
return YES;
|
||||
NSRunAlertPanel(@"Create Makefile",
|
||||
@"Couldn't create %@",
|
||||
@"Ok",nil,nil, mfl);
|
||||
return NO;
|
||||
}
|
||||
|
||||
return NO;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)createPostambleForProject:(PCProject *)project
|
||||
|
@ -241,12 +270,20 @@ static PCMakefileFactory *_factory = nil;
|
|||
NSString *postamble = nil;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
bundle = [NSBundle bundleForClass:[self class]];
|
||||
template = [bundle pathForResource:@"postamble" ofType:@"template"];
|
||||
bundle = [NSBundle bundleForClass: [self class]];
|
||||
template = [bundle pathForResource: @"postamble" ofType: @"template"];
|
||||
postamble = [[project projectPath]
|
||||
stringByAppendingPathComponent:@"GNUmakefile.postamble"];
|
||||
stringByAppendingPathComponent: @"GNUmakefile.postamble"];
|
||||
|
||||
return [fm copyPath:template toPath:postamble handler:nil];
|
||||
if (![fm copyPath:template toPath:postamble handler:nil])
|
||||
{
|
||||
NSRunAlertPanel(@"Create Makefile",
|
||||
@"Couldn't create %@",
|
||||
@"Ok",nil,nil, postamble);
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)appendString:(NSString *)aString
|
||||
|
@ -263,22 +300,22 @@ static PCMakefileFactory *_factory = nil;
|
|||
NSString *lib = nil;
|
||||
NSEnumerator *enumerator = nil;
|
||||
|
||||
[libs removeObject:@"gnustep-base"];
|
||||
[libs removeObject:@"gnustep-gui"];
|
||||
[libs removeObject: @"gnustep-base"];
|
||||
[libs removeObject: @"gnustep-gui"];
|
||||
|
||||
if (libs == nil || [libs count] == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[self appendString:@"\n\n#\n# Libraries\n#\n"];
|
||||
[self appendString: @"\n\n#\n# Libraries\n#\n"];
|
||||
[self appendString:
|
||||
[NSString stringWithFormat:@"%@_LIBRARIES_DEPEND_UPON += ",pnme]];
|
||||
[NSString stringWithFormat: @"%@_LIBRARIES_DEPEND_UPON += ",pnme]];
|
||||
|
||||
enumerator = [libs objectEnumerator];
|
||||
while ((lib = [enumerator nextObject]))
|
||||
{
|
||||
[self appendString:[NSString stringWithFormat:@"-l%@ ",lib]];
|
||||
[self appendString: [NSString stringWithFormat: @"-l%@ ",lib]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,9 +334,9 @@ static PCMakefileFactory *_factory = nil;
|
|||
|
||||
[self appendString:COMMENT_HEADERS];
|
||||
[self appendString:
|
||||
[NSString stringWithFormat:@"%@_HEADER_FILES = \\\n", target]];
|
||||
[NSString stringWithFormat: @"%@_HEADER_FILES = \\\n", target]];
|
||||
|
||||
[self appendString:[array componentsJoinedByString:@" \\\n"]];
|
||||
[self appendString: [array componentsJoinedByString: @" \\\n"]];
|
||||
}
|
||||
|
||||
- (void)appendClasses:(NSArray *)array
|
||||
|
@ -314,16 +351,50 @@ static PCMakefileFactory *_factory = nil;
|
|||
|
||||
- (void)appendClasses:(NSArray *)array forTarget:(NSString *)target
|
||||
{
|
||||
NSEnumerator *oenum;
|
||||
NSMutableArray *marray = nil;
|
||||
NSMutableArray *mmarray = nil;
|
||||
NSString *file;
|
||||
|
||||
if (array == nil || [array count] == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[self appendString:COMMENT_CLASSES];
|
||||
[self appendString:
|
||||
[NSString stringWithFormat:@"%@_OBJC_FILES = \\\n",target]];
|
||||
oenum = [array objectEnumerator];
|
||||
while ((file = [oenum nextObject]))
|
||||
{
|
||||
if ([file hasSuffix: @".m"])
|
||||
{
|
||||
if (marray == nil)
|
||||
{
|
||||
marray = [NSMutableArray array];
|
||||
}
|
||||
[marray addObject: file];
|
||||
}
|
||||
else if ([file hasSuffix: @".mm"])
|
||||
{
|
||||
if (mmarray == nil)
|
||||
{
|
||||
mmarray = [NSMutableArray array];
|
||||
}
|
||||
[mmarray addObject: file];
|
||||
}
|
||||
}
|
||||
|
||||
[self appendString:[array componentsJoinedByString:@" \\\n"]];
|
||||
if (marray)
|
||||
{
|
||||
[self appendString:COMMENT_CLASSES];
|
||||
[self appendString: [NSString stringWithFormat: @"%@_OBJC_FILES = \\\n",target]];
|
||||
[self appendString: [marray componentsJoinedByString: @" \\\n"]];
|
||||
}
|
||||
|
||||
if (mmarray)
|
||||
{
|
||||
[self appendString:COMMENT_OCPPCLASSES];
|
||||
[self appendString: [NSString stringWithFormat: @"%@_OBJCC_FILES = \\\n",target]];
|
||||
[self appendString: [mmarray componentsJoinedByString: @" \\\n"]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)appendOtherSources:(NSArray *)array
|
||||
|
@ -339,6 +410,7 @@ static PCMakefileFactory *_factory = nil;
|
|||
- (void)appendOtherSources:(NSArray *)array forTarget: (NSString *)target
|
||||
{
|
||||
NSMutableArray *marray = nil;
|
||||
NSMutableArray *mmarray = nil;
|
||||
NSMutableArray *oarray = nil;
|
||||
NSEnumerator *oenum;
|
||||
NSString *file;
|
||||
|
@ -360,6 +432,14 @@ static PCMakefileFactory *_factory = nil;
|
|||
}
|
||||
[marray addObject: file];
|
||||
}
|
||||
else if ([file hasSuffix: @".mm"])
|
||||
{
|
||||
if (mmarray == nil)
|
||||
{
|
||||
mmarray = [NSMutableArray array];
|
||||
}
|
||||
[mmarray addObject: file];
|
||||
}
|
||||
else // non .m file
|
||||
{
|
||||
if (oarray == nil)
|
||||
|
@ -377,11 +457,11 @@ static PCMakefileFactory *_factory = nil;
|
|||
{
|
||||
oenum = [oarray objectEnumerator];
|
||||
|
||||
[self appendString:[NSString stringWithFormat:@"%@_C_FILES = ", target]];
|
||||
[self appendString: [NSString stringWithFormat: @"%@_C_FILES = ", target]];
|
||||
|
||||
while ((file = [oenum nextObject]))
|
||||
{
|
||||
[self appendString:[NSString stringWithFormat:@"\\\n%@ ",file]];
|
||||
[self appendString: [NSString stringWithFormat: @"\\\n%@ ",file]];
|
||||
}
|
||||
[self appendString: @"\n\n"];
|
||||
}
|
||||
|
@ -391,11 +471,24 @@ static PCMakefileFactory *_factory = nil;
|
|||
{
|
||||
oenum = [marray objectEnumerator];
|
||||
|
||||
[self appendString:[NSString stringWithFormat:@"%@_OBJC_FILES += ",pnme]];
|
||||
[self appendString: [NSString stringWithFormat: @"%@_OBJC_FILES += ",pnme]];
|
||||
|
||||
while ((file = [oenum nextObject]))
|
||||
{
|
||||
[self appendString:[NSString stringWithFormat:@"\\\n%@ ", file]];
|
||||
[self appendString: [NSString stringWithFormat: @"\\\n%@ ", file]];
|
||||
}
|
||||
}
|
||||
|
||||
// Add .mm files if any
|
||||
if (mmarray && [marray count] != 0)
|
||||
{
|
||||
oenum = [mmarray objectEnumerator];
|
||||
|
||||
[self appendString: [NSString stringWithFormat: @"%@_OBJCC_FILES += ",pnme]];
|
||||
|
||||
while ((file = [oenum nextObject]))
|
||||
{
|
||||
[self appendString: [NSString stringWithFormat: @"\\\n%@ ", file]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -406,7 +499,7 @@ static PCMakefileFactory *_factory = nil;
|
|||
int count = [array count];
|
||||
NSString *string = nil;
|
||||
NSString *item = nil;
|
||||
NSString *eol = [NSString stringWithString:@"\\\n"];
|
||||
NSString *eol = @"\\\n";
|
||||
|
||||
if (array == nil || count <= 0)
|
||||
{
|
||||
|
@ -416,17 +509,17 @@ static PCMakefileFactory *_factory = nil;
|
|||
// Header
|
||||
[self appendString:COMMENT_RESOURCES];
|
||||
[self appendString:
|
||||
[NSString stringWithFormat:@"%@_RESOURCE_FILES = \\\n",pnme]];
|
||||
[NSString stringWithFormat: @"%@_RESOURCE_FILES = \\\n",pnme]];
|
||||
|
||||
// Items
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
item = [array objectAtIndex:i];
|
||||
string = [NSString stringWithFormat:@"%@/%@ %@", dir, item, eol];
|
||||
string = [NSString stringWithFormat: @"%@/%@ %@", dir, item, eol];
|
||||
[self appendString:string];
|
||||
if (i == (count-2))
|
||||
{
|
||||
eol = [NSString stringWithString:@"\n"];
|
||||
eol = @"\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -438,17 +531,17 @@ static PCMakefileFactory *_factory = nil;
|
|||
return;
|
||||
}
|
||||
|
||||
[self appendString:@"\\\n"];
|
||||
[self appendString:[array componentsJoinedByString:@" \\\n"]];
|
||||
[self appendString: @"\\\n"];
|
||||
[self appendString: [array componentsJoinedByString: @" \\\n"]];
|
||||
}
|
||||
|
||||
- (void)appendLocalizedResources:(NSArray *)resources
|
||||
forLanguages:(NSArray *)languages
|
||||
{
|
||||
NSString *langs = [languages componentsJoinedByString:@" "];
|
||||
NSString *langs = [languages componentsJoinedByString: @" "];
|
||||
NSString *string = nil;
|
||||
NSString *item = nil;
|
||||
NSString *eol = [NSString stringWithString:@"\\\n"];
|
||||
NSString *eol = @"\\\n";
|
||||
int i = 0;
|
||||
int count = [resources count];
|
||||
|
||||
|
@ -461,20 +554,20 @@ static PCMakefileFactory *_factory = nil;
|
|||
[self appendString:COMMENT_LOCALIZATION];
|
||||
|
||||
// Languages
|
||||
string = [NSString stringWithFormat:@"%@_LANGUAGES = %@\n", pnme, langs];
|
||||
string = [NSString stringWithFormat: @"%@_LANGUAGES = %@\n", pnme, langs];
|
||||
[self appendString:string];
|
||||
|
||||
// Items
|
||||
[self appendString:
|
||||
[NSString stringWithFormat:@"%@_LOCALIZED_RESOURCE_FILES = \\\n",pnme]];
|
||||
[NSString stringWithFormat: @"%@_LOCALIZED_RESOURCE_FILES = \\\n",pnme]];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (i == (count-1))
|
||||
{
|
||||
eol = [NSString stringWithString:@"\n"];
|
||||
eol = @"\n";
|
||||
}
|
||||
item = [resources objectAtIndex:i];
|
||||
string = [NSString stringWithFormat:@"%@ %@", item, eol];
|
||||
string = [NSString stringWithFormat: @"%@ %@", item, eol];
|
||||
[self appendString:string];
|
||||
}
|
||||
}
|
||||
|
@ -490,21 +583,21 @@ static PCMakefileFactory *_factory = nil;
|
|||
}
|
||||
|
||||
[self appendString:COMMENT_SUBPROJECTS];
|
||||
[self appendString:@"SUBPROJECTS = "];
|
||||
[self appendString: @"SUBPROJECTS = "];
|
||||
|
||||
enumerator = [array objectEnumerator];
|
||||
while ((tmp = [enumerator nextObject]))
|
||||
{
|
||||
tmp = [tmp stringByAppendingPathExtension:@"subproj"];
|
||||
[self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
|
||||
tmp = [tmp stringByAppendingPathExtension: @"subproj"];
|
||||
[self appendString: [NSString stringWithFormat: @"\\\n%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSData *)encodedMakefile
|
||||
{
|
||||
NSAssert( mfile, @"No valid makefile available!");
|
||||
NSAssert(mfile, @"No valid makefile available!");
|
||||
|
||||
return [mfile dataUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
return [mfile dataUsingEncoding: [NSString defaultCStringEncoding]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,892 +0,0 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2001 Free Software Foundation
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
#import <ProjectCenter/PCPrefController.h>
|
||||
|
||||
// TODO: rewrite it as PCPreferences, use +sharedPreferences instead of
|
||||
// [NSUserDefaults standardUserDefaults] in every part of ProjectCenter
|
||||
|
||||
@implementation PCPrefController
|
||||
|
||||
// ===========================================================================
|
||||
// ==== Class methods
|
||||
// ===========================================================================
|
||||
|
||||
static PCPrefController *_prefCtrllr = nil;
|
||||
|
||||
+ (PCPrefController *)sharedPCPreferences
|
||||
{
|
||||
if (!_prefCtrllr)
|
||||
{
|
||||
_prefCtrllr = [[PCPrefController alloc] init];
|
||||
}
|
||||
|
||||
return _prefCtrllr;
|
||||
}
|
||||
|
||||
//
|
||||
- (id)init
|
||||
{
|
||||
NSDictionary *prefs = nil;
|
||||
|
||||
if (!(self = [super init]))
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
// The prefs from the defaults
|
||||
prefs = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||
preferencesDict = [[NSMutableDictionary alloc] initWithDictionary:prefs];
|
||||
|
||||
if ([preferencesDict objectForKey:@"Version"] == nil)
|
||||
{
|
||||
[self setDefaultValues];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
#ifdef DEVELOPMENT
|
||||
NSLog(@"PCPrefController: dealloc");
|
||||
#endif
|
||||
|
||||
RELEASE(preferencesDict);
|
||||
|
||||
RELEASE(panel);
|
||||
|
||||
RELEASE(buildingView);
|
||||
RELEASE(savingView);
|
||||
RELEASE(keyBindingsView);
|
||||
RELEASE(miscView);
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)setDefaultValues
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
PCLogInfo(self, @"setDefaultValues");
|
||||
|
||||
// Clean preferences
|
||||
[preferencesDict removeAllObjects];
|
||||
|
||||
[preferencesDict setObject:@"0.4" forKey:@"Version"];
|
||||
|
||||
// Building
|
||||
[preferencesDict setObject:@"" forKey:SuccessSound];
|
||||
[preferencesDict setObject:@"" forKey:FailureSound];
|
||||
[preferencesDict setObject:@"YES" forKey:PromptOnClean];
|
||||
[preferencesDict setObject:@"" forKey:RootBuildDirectory];
|
||||
|
||||
// Saving
|
||||
[preferencesDict setObject:@"YES" forKey:SaveOnQuit];
|
||||
[preferencesDict setObject:@"YES" forKey:KeepBackup];
|
||||
[preferencesDict setObject:@"120" forKey:AutoSavePeriod];
|
||||
|
||||
// Key Bindings
|
||||
[preferencesDict setObject:@"Tab" forKey:TabBehaviour];
|
||||
|
||||
// Miscellaneous
|
||||
[preferencesDict setObject:@"YES" forKey:PromptOnQuit];
|
||||
[preferencesDict setObject:@"YES" forKey:DeleteCacheWhenQuitting];
|
||||
[preferencesDict setObject:@"YES" forKey:FullPathInFilePanels];
|
||||
[preferencesDict setObject:@"/usr/bin/make" forKey:BuildTool];
|
||||
[preferencesDict setObject:@"/usr/bin/gdb" forKey:Debugger];
|
||||
[preferencesDict setObject:@"ProjectCenter" forKey:Editor];
|
||||
|
||||
// Interface
|
||||
[preferencesDict setObject:@"YES" forKey:SeparateBuilder];
|
||||
[preferencesDict setObject:@"YES" forKey:SeparateLauncher];
|
||||
[preferencesDict setObject:@"NO" forKey:SeparateEditor];
|
||||
[preferencesDict setObject:@"YES" forKey:SeparateLoadedFiles];
|
||||
|
||||
[preferencesDict setObject:@"30" forKey:EditorLines];
|
||||
[preferencesDict setObject:@"80" forKey:EditorColumns];
|
||||
|
||||
[preferencesDict setObject:@"YES" forKey:RememberWindows];
|
||||
[preferencesDict setObject:@"NO" forKey:DisplayLog];
|
||||
|
||||
[ud setPersistentDomain:preferencesDict forName:@"ProjectCenter"];
|
||||
[ud synchronize];
|
||||
}
|
||||
|
||||
- (void)loadPreferences
|
||||
{
|
||||
NSDictionary *prefs;
|
||||
NSString *val;
|
||||
NSString *defValue = @"";
|
||||
|
||||
prefs = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||
[preferencesDict addEntriesFromDictionary: prefs];
|
||||
|
||||
// Fill in the defaults
|
||||
|
||||
// Building
|
||||
[successField setStringValue:
|
||||
(val = [preferencesDict objectForKey:SuccessSound]) ? val : defValue];
|
||||
[failureField setStringValue:
|
||||
(val = [preferencesDict objectForKey:FailureSound]) ? val : defValue];
|
||||
|
||||
[promptOnClean setState:
|
||||
([[preferencesDict objectForKey:PromptOnClean]
|
||||
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
|
||||
|
||||
[rootBuildDirField setStringValue:
|
||||
(val = [preferencesDict objectForKey:RootBuildDirectory]) ? val : defValue];
|
||||
|
||||
// Saving
|
||||
[saveOnQuit setState:
|
||||
([[preferencesDict objectForKey: SaveOnQuit]
|
||||
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
|
||||
|
||||
[keepBackup setState:
|
||||
([[preferencesDict objectForKey: KeepBackup]
|
||||
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
|
||||
|
||||
defValue = @"120";
|
||||
[autosaveField setStringValue:
|
||||
(val = [preferencesDict objectForKey: AutoSavePeriod]) ? val : defValue];
|
||||
[autosaveSlider setFloatValue:[[autosaveField stringValue] floatValue]];
|
||||
|
||||
// Key Bindings
|
||||
val = [preferencesDict objectForKey:TabBehaviour];
|
||||
[tabMatrix deselectAllCells];
|
||||
if ([val isEqualToString:@"Tab"])
|
||||
{
|
||||
[tabMatrix selectCellAtRow:0 column:0];
|
||||
}
|
||||
else if ([val isEqualToString:@"IndentAlways"])
|
||||
{
|
||||
[tabMatrix selectCellAtRow:1 column:0];
|
||||
}
|
||||
else if ([val isEqualToString:@"IndentAtBeginning"])
|
||||
{
|
||||
[tabMatrix selectCellAtRow:2 column:0];
|
||||
}
|
||||
else if ([val isEqualToString:@"Spaces"])
|
||||
{
|
||||
[tabMatrix selectCellAtRow:3 column:0];
|
||||
}
|
||||
|
||||
// Miscellaneous
|
||||
[promptWhenQuit setState:
|
||||
([[preferencesDict objectForKey: PromptOnQuit]
|
||||
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
|
||||
[deleteCache setState:
|
||||
([[preferencesDict objectForKey: DeleteCacheWhenQuitting]
|
||||
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
|
||||
[fullPathInFilePanels setState:
|
||||
([[preferencesDict objectForKey: FullPathInFilePanels]
|
||||
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
|
||||
|
||||
[buildToolField setStringValue:
|
||||
(val = [preferencesDict objectForKey:BuildTool]) ? val : PCDefaultBuildTool];
|
||||
[debuggerField setStringValue:
|
||||
(val = [preferencesDict objectForKey: Debugger]) ? val : PCDefaultDebugger];
|
||||
[editorField setStringValue:
|
||||
(val = [preferencesDict objectForKey: Editor]) ? val : @"ProjectCenter"];
|
||||
|
||||
// Interface
|
||||
[separateBuilder setState:
|
||||
([[preferencesDict objectForKey: SeparateBuilder]
|
||||
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
|
||||
[separateLauncher setState:
|
||||
([[preferencesDict objectForKey: SeparateLauncher]
|
||||
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
|
||||
[separateEditor setState:
|
||||
([[preferencesDict objectForKey: SeparateEditor]
|
||||
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
|
||||
[separateLoadedFiles setState:
|
||||
([[preferencesDict objectForKey: SeparateLoadedFiles]
|
||||
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
|
||||
|
||||
[editorLinesField setStringValue:
|
||||
(val = [preferencesDict objectForKey: EditorLines]) ? val : @"30"];
|
||||
[editorColumnsField setStringValue:
|
||||
(val = [preferencesDict objectForKey: EditorColumns]) ? val : @"80"];
|
||||
if ([separateEditor state] == NSOffState
|
||||
|| ![[editorField stringValue] isEqualToString:@"ProjectCenter"])
|
||||
{
|
||||
[self setEditorSizeEnabled:NO];
|
||||
}
|
||||
|
||||
[rememberWindows setState:
|
||||
([[preferencesDict objectForKey: RememberWindows]
|
||||
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
|
||||
[displayLog setState:
|
||||
([[preferencesDict objectForKey:DisplayLog]
|
||||
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
NSArray *tabMatrixCells;
|
||||
unsigned i;
|
||||
|
||||
[promptOnClean setRefusesFirstResponder:YES];
|
||||
|
||||
[saveOnQuit setRefusesFirstResponder:YES];
|
||||
[keepBackup setRefusesFirstResponder:YES];
|
||||
|
||||
tabMatrixCells = [tabMatrix cells];
|
||||
|
||||
for (i = 0; i < [tabMatrixCells count]; i++)
|
||||
{
|
||||
[[tabMatrixCells objectAtIndex:i] setRefusesFirstResponder:YES];
|
||||
}
|
||||
|
||||
[promptWhenQuit setRefusesFirstResponder:YES];
|
||||
[deleteCache setRefusesFirstResponder:YES];
|
||||
[fullPathInFilePanels setRefusesFirstResponder:YES];
|
||||
|
||||
[separateBuilder setRefusesFirstResponder:YES];
|
||||
[separateLauncher setRefusesFirstResponder:YES];
|
||||
[separateEditor setRefusesFirstResponder:YES];
|
||||
[separateLoadedFiles setRefusesFirstResponder:YES];
|
||||
|
||||
[rememberWindows setRefusesFirstResponder:YES];
|
||||
[displayLog setRefusesFirstResponder:YES];
|
||||
}
|
||||
|
||||
// Accessory
|
||||
- (NSDictionary *)preferencesDict
|
||||
{
|
||||
return preferencesDict;
|
||||
}
|
||||
|
||||
- (id)objectForKey:(NSString *)key
|
||||
{
|
||||
return [preferencesDict objectForKey:key];
|
||||
}
|
||||
|
||||
- (NSString *)selectFileWithTypes:(NSArray *)types
|
||||
{
|
||||
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
|
||||
NSString *file = nil;
|
||||
NSOpenPanel *openPanel;
|
||||
int retval;
|
||||
|
||||
openPanel = [NSOpenPanel openPanel];
|
||||
[openPanel setAllowsMultipleSelection:NO];
|
||||
[openPanel setCanChooseDirectories:YES];
|
||||
[openPanel setCanChooseFiles:YES];
|
||||
|
||||
retval = [openPanel
|
||||
runModalForDirectory:[def objectForKey:@"LastOpenDirectory"]
|
||||
file:nil
|
||||
types:types];
|
||||
|
||||
if (retval == NSOKButton)
|
||||
{
|
||||
[def setObject:[openPanel directory] forKey:@"LastOpenDirectory"];
|
||||
file = [[openPanel filenames] objectAtIndex:0];
|
||||
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
- (void)showPanel:(id)sender
|
||||
{
|
||||
if (panel == nil
|
||||
&& [NSBundle loadNibNamed:@"Preferences" owner:self] == NO)
|
||||
{
|
||||
PCLogError(self, @"error loading NIB file!");
|
||||
return;
|
||||
}
|
||||
|
||||
[panel setFrameAutosaveName:@"Preferences"];
|
||||
if (![panel setFrameUsingName: @"Preferences"])
|
||||
{
|
||||
[panel center];
|
||||
}
|
||||
RETAIN(buildingView);
|
||||
RETAIN(savingView);
|
||||
RETAIN(keyBindingsView);
|
||||
RETAIN(miscView);
|
||||
RETAIN(interfaceView);
|
||||
|
||||
// The popup and selected view
|
||||
[popupButton removeAllItems];
|
||||
[popupButton addItemWithTitle:@"Building"];
|
||||
[popupButton addItemWithTitle:@"Saving"];
|
||||
[popupButton addItemWithTitle:@"Key Bindings"];
|
||||
[popupButton addItemWithTitle:@"Miscellaneous"];
|
||||
[popupButton addItemWithTitle:@"Interface"];
|
||||
|
||||
[popupButton selectItemWithTitle:@"Building"];
|
||||
[self popupChanged:popupButton];
|
||||
|
||||
// Load saved prefs
|
||||
[self loadPreferences];
|
||||
|
||||
[panel orderFront:self];
|
||||
}
|
||||
|
||||
//
|
||||
- (void)popupChanged:(id)sender
|
||||
{
|
||||
NSView *view = nil;
|
||||
|
||||
switch ([sender indexOfSelectedItem])
|
||||
{
|
||||
case 0:
|
||||
view = buildingView;
|
||||
break;
|
||||
case 1:
|
||||
view = savingView;
|
||||
break;
|
||||
case 2:
|
||||
view = keyBindingsView;
|
||||
break;
|
||||
case 3:
|
||||
view = miscView;
|
||||
break;
|
||||
case 4:
|
||||
view = interfaceView;
|
||||
break;
|
||||
}
|
||||
|
||||
[sectionsView setContentView:view];
|
||||
[sectionsView display];
|
||||
}
|
||||
|
||||
// Building
|
||||
- (void)setSuccessSound:(id)sender
|
||||
{
|
||||
NSArray *types = [NSArray arrayWithObjects:@"snd",@"au",@"wav",nil];
|
||||
NSString *path = [self selectFileWithTypes:types];
|
||||
|
||||
if (path)
|
||||
{
|
||||
[successField setStringValue: path];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:path
|
||||
forKey:SuccessSound];
|
||||
[preferencesDict setObject:path forKey:SuccessSound];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setFailureSound:(id)sender
|
||||
{
|
||||
NSArray *types = [NSArray arrayWithObjects:@"snd",@"au",@"wav",nil];
|
||||
NSString *path = [self selectFileWithTypes:types];
|
||||
|
||||
if (path)
|
||||
{
|
||||
[failureField setStringValue:path];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:path
|
||||
forKey:FailureSound];
|
||||
[preferencesDict setObject:path forKey:FailureSound];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setRootBuildDir:(id)sender
|
||||
{
|
||||
NSString *path;
|
||||
|
||||
if (sender == rootBuildDirButton)
|
||||
{
|
||||
path = [self selectFileWithTypes:nil];
|
||||
[rootBuildDirField setStringValue:path];
|
||||
}
|
||||
else
|
||||
{
|
||||
path = [rootBuildDirField stringValue];
|
||||
}
|
||||
|
||||
if (path)
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setObject:path
|
||||
forKey:RootBuildDirectory];
|
||||
[preferencesDict setObject:path
|
||||
forKey:RootBuildDirectory];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setPromptOnClean:(id)sender
|
||||
{
|
||||
NSUserDefaults *def = nil;
|
||||
|
||||
if (promptOnClean == nil)
|
||||
{// HACK!!! need to be fixed in GNUstep
|
||||
promptOnClean = sender;
|
||||
return;
|
||||
}
|
||||
|
||||
def = [NSUserDefaults standardUserDefaults];
|
||||
switch ([sender state])
|
||||
{
|
||||
case NSOffState:
|
||||
[def setObject:@"NO" forKey:PromptOnClean];
|
||||
break;
|
||||
case NSOnState:
|
||||
[def setObject:@"YES" forKey:PromptOnClean];
|
||||
break;
|
||||
}
|
||||
[def synchronize];
|
||||
|
||||
[preferencesDict setObject:[def objectForKey:PromptOnClean]
|
||||
forKey:PromptOnClean];
|
||||
}
|
||||
|
||||
// Saving
|
||||
- (void)setSaveOnQuit:(id)sender
|
||||
{
|
||||
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (saveOnQuit == nil)
|
||||
{ // HACK!!!
|
||||
saveOnQuit = sender;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ([sender state])
|
||||
{
|
||||
case 0:
|
||||
[def setObject:@"NO" forKey:SaveOnQuit];
|
||||
break;
|
||||
case 1:
|
||||
[def setObject:@"YES" forKey:SaveOnQuit];
|
||||
break;
|
||||
}
|
||||
[def synchronize];
|
||||
|
||||
[preferencesDict setObject:[def objectForKey:SaveOnQuit]
|
||||
forKey:SaveOnQuit];
|
||||
}
|
||||
|
||||
- (void)setKeepBackup:(id)sender
|
||||
{
|
||||
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (keepBackup == nil)
|
||||
{ // HACK!!!
|
||||
keepBackup = sender;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ([[sender selectedCell] state])
|
||||
{
|
||||
case 0:
|
||||
[def setObject:@"NO" forKey:KeepBackup];
|
||||
break;
|
||||
case 1:
|
||||
[def setObject:@"YES" forKey:KeepBackup];
|
||||
break;
|
||||
}
|
||||
[def synchronize];
|
||||
|
||||
[preferencesDict setObject:[def objectForKey:KeepBackup]
|
||||
forKey:KeepBackup];
|
||||
}
|
||||
|
||||
- (void)setSavePeriod:(id)sender
|
||||
{
|
||||
NSString *periodString = nil;
|
||||
|
||||
if (sender == autosaveSlider)
|
||||
{
|
||||
[autosaveField setIntValue:[sender intValue]];
|
||||
}
|
||||
else if (sender == autosaveField)
|
||||
{
|
||||
if ([autosaveField floatValue] < [autosaveSlider minValue])
|
||||
{
|
||||
[autosaveField setFloatValue:[autosaveSlider minValue]];
|
||||
}
|
||||
else if ([autosaveField floatValue] > [autosaveSlider maxValue])
|
||||
{
|
||||
[autosaveField setFloatValue:[autosaveSlider maxValue]];
|
||||
}
|
||||
[autosaveSlider setFloatValue:[autosaveField floatValue]];
|
||||
}
|
||||
|
||||
periodString = [autosaveField stringValue];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:periodString
|
||||
forKey:AutoSavePeriod];
|
||||
[preferencesDict setObject:periodString forKey:AutoSavePeriod];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCSavePeriodDidChangeNotification
|
||||
object:periodString];
|
||||
}
|
||||
|
||||
// Key bindings
|
||||
- (void)setTabBehaviour:(id)sender
|
||||
{
|
||||
id cell = [sender selectedCell];
|
||||
NSString *tabBehaviour = nil;
|
||||
|
||||
PCLogInfo(self, @"setTabBehaviour: %@", [cell title]);
|
||||
|
||||
if ([[cell title] isEqualToString:@"Insert Tab"])
|
||||
{
|
||||
tabBehaviour = [NSString stringWithString:@"Tab"];
|
||||
}
|
||||
else if ([[cell title] isEqualToString:@"Indent only at beginning of line"])
|
||||
{
|
||||
tabBehaviour = [NSString stringWithString:@"IndentAtBeginning"];
|
||||
}
|
||||
else if ([[cell title] isEqualToString:@"Indent always"])
|
||||
{
|
||||
tabBehaviour = [NSString stringWithString:@"IndentAlways"];
|
||||
}
|
||||
else if ([[cell title] isEqualToString:@"Insert spaces"])
|
||||
{
|
||||
tabBehaviour = [NSString stringWithString:@"Spaces"];
|
||||
[tabSpacesField setEnabled:YES];
|
||||
[tabSpacesField becomeFirstResponder];
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:tabBehaviour
|
||||
forKey:TabBehaviour];
|
||||
[preferencesDict setObject:tabBehaviour forKey:TabBehaviour];
|
||||
}
|
||||
|
||||
- (void)setTabSpaces:(id)sender
|
||||
{
|
||||
if ([[tabSpacesField stringValue] isEqualToString:@""])
|
||||
{
|
||||
[tabSpacesField setStringValue:@"2"];
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject:[tabSpacesField stringValue]
|
||||
forKey:TabSpaces];
|
||||
[preferencesDict setObject:[tabSpacesField stringValue] forKey:TabSpaces];
|
||||
}
|
||||
|
||||
// Miscellaneous
|
||||
- (void)setPromptWhenQuit:(id)sender
|
||||
{
|
||||
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (promptWhenQuit == nil)
|
||||
{
|
||||
promptWhenQuit = sender;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ([sender state])
|
||||
{
|
||||
case 0:
|
||||
[def setObject:@"NO" forKey:PromptOnQuit];
|
||||
break;
|
||||
case 1:
|
||||
[def setObject:@"YES" forKey:PromptOnQuit];
|
||||
break;
|
||||
}
|
||||
[def synchronize];
|
||||
|
||||
[preferencesDict setObject:[def objectForKey:PromptOnQuit]
|
||||
forKey:PromptOnQuit];
|
||||
}
|
||||
|
||||
- (void)setDeleteCache:(id)sender
|
||||
{
|
||||
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (deleteCache == nil)
|
||||
{
|
||||
deleteCache = sender;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ([sender state])
|
||||
{
|
||||
case 0:
|
||||
[def setObject:@"NO" forKey:DeleteCacheWhenQuitting];
|
||||
break;
|
||||
case 1:
|
||||
[def setObject:@"YES" forKey:DeleteCacheWhenQuitting];
|
||||
break;
|
||||
}
|
||||
[def synchronize];
|
||||
|
||||
[preferencesDict setObject:[def objectForKey:DeleteCacheWhenQuitting]
|
||||
forKey:DeleteCacheWhenQuitting];
|
||||
}
|
||||
|
||||
- (void)setFullPathInFilePanels:(id)sender
|
||||
{
|
||||
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (fullPathInFilePanels == nil)
|
||||
{
|
||||
fullPathInFilePanels = sender;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ([sender state])
|
||||
{
|
||||
case 0:
|
||||
[def setObject:@"NO" forKey:FullPathInFilePanels];
|
||||
break;
|
||||
case 1:
|
||||
[def setObject:@"YES" forKey:FullPathInFilePanels];
|
||||
break;
|
||||
}
|
||||
[def synchronize];
|
||||
|
||||
[preferencesDict setObject:[def objectForKey:FullPathInFilePanels]
|
||||
forKey:FullPathInFilePanels];
|
||||
}
|
||||
|
||||
- (void)setBuildTool:(id)sender
|
||||
{
|
||||
NSString *path = [buildToolField stringValue];
|
||||
|
||||
if ([path isEqualToString:@""] || !path)
|
||||
{
|
||||
[buildToolField setStringValue:PCDefaultBuildTool];
|
||||
path = [buildToolField stringValue];
|
||||
}
|
||||
else if (!path || ![[NSFileManager defaultManager] fileExistsAtPath:path])
|
||||
{
|
||||
[buildToolField selectText:self];
|
||||
NSRunAlertPanel(@"Build Tool not found!",
|
||||
@"File %@ doesn't exist!",
|
||||
@"OK", nil, nil, path);
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:path forKey:BuildTool];
|
||||
[preferencesDict setObject:path forKey:BuildTool];
|
||||
}
|
||||
|
||||
- (void)setDebugger:(id)sender
|
||||
{
|
||||
NSString *path = [debuggerField stringValue];
|
||||
|
||||
if ([path isEqualToString:@""] || !path)
|
||||
{
|
||||
[debuggerField setStringValue:PCDefaultDebugger];
|
||||
path = [debuggerField stringValue];
|
||||
}
|
||||
else if (!path || ![[NSFileManager defaultManager] fileExistsAtPath:path])
|
||||
{
|
||||
[debuggerField selectText:self];
|
||||
NSRunAlertPanel(@"Debugger not found!",
|
||||
@"File %@ doesn't exist!",
|
||||
@"OK", nil, nil, path);
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:path forKey:Debugger];
|
||||
[preferencesDict setObject:path forKey:Debugger];
|
||||
}
|
||||
|
||||
- (void)setEditor:(id)sender
|
||||
{
|
||||
NSString *path = [editorField stringValue];
|
||||
NSString *editorPath = nil;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
[separateEditor setEnabled:YES];
|
||||
[self setEditorSizeEnabled:YES];
|
||||
|
||||
editorPath = [[path componentsSeparatedByString:@" "] objectAtIndex:0];
|
||||
if ([path isEqualToString:@""] || !path)
|
||||
{
|
||||
[editorField setStringValue:@"ProjectCenter"];
|
||||
path = [editorField stringValue];
|
||||
}
|
||||
else if (![path isEqualToString:@"ProjectCenter"])
|
||||
{
|
||||
if (![fm fileExistsAtPath:editorPath])
|
||||
{
|
||||
[editorField selectText:self];
|
||||
NSRunAlertPanel(@"Editor not found!",
|
||||
@"File %@ doesn't exist!",
|
||||
@"Close", nil, nil, path);
|
||||
}
|
||||
else if (![fm isExecutableFileAtPath:editorPath])
|
||||
{
|
||||
[editorField selectText:self];
|
||||
NSRunAlertPanel(@"Editor file error!",
|
||||
@"File %@ exist but is not executable!",
|
||||
@"Close", nil, nil, path);
|
||||
}
|
||||
[separateEditor setEnabled:NO];
|
||||
[self setEditorSizeEnabled:NO];
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:path forKey:Editor];
|
||||
[preferencesDict setObject:path forKey:Editor];
|
||||
}
|
||||
|
||||
// Interface
|
||||
- (void)setDisplayPanels:(id)sender
|
||||
{
|
||||
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
|
||||
NSString *key = nil;
|
||||
|
||||
if (sender == separateBuilder)
|
||||
{
|
||||
key = [NSString stringWithString: SeparateBuilder];
|
||||
}
|
||||
else if (sender == separateLauncher)
|
||||
{
|
||||
key = [NSString stringWithString: SeparateLauncher];
|
||||
}
|
||||
else if (sender == separateEditor)
|
||||
{
|
||||
key = [NSString stringWithString: SeparateEditor];
|
||||
}
|
||||
else if (sender == separateLoadedFiles)
|
||||
{
|
||||
key = [NSString stringWithString: SeparateLoadedFiles];
|
||||
}
|
||||
|
||||
switch ([sender state])
|
||||
{
|
||||
case NSOffState:
|
||||
[def setObject: @"NO" forKey: key];
|
||||
break;
|
||||
case NSOnState:
|
||||
[def setObject:@"YES" forKey: key];
|
||||
break;
|
||||
}
|
||||
[def synchronize];
|
||||
|
||||
if (sender == separateEditor)
|
||||
{
|
||||
if ([sender state] == NSOffState)
|
||||
{
|
||||
[self setEditorSizeEnabled:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setEditorSizeEnabled:YES];
|
||||
}
|
||||
[sender becomeFirstResponder];
|
||||
}
|
||||
|
||||
[preferencesDict setObject:[def objectForKey:key]
|
||||
forKey:key];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCPreferencesDidChangeNotification
|
||||
object:self];
|
||||
}
|
||||
|
||||
- (void)setEditorSize:(id)sender
|
||||
{
|
||||
NSString *val = nil;
|
||||
NSString *key = nil;
|
||||
|
||||
if (sender == editorLinesField)
|
||||
{
|
||||
key = EditorLines;
|
||||
val = [editorLinesField stringValue];
|
||||
}
|
||||
else if (sender == editorColumnsField)
|
||||
{
|
||||
key = EditorColumns;
|
||||
val = [editorColumnsField stringValue];
|
||||
}
|
||||
[[NSUserDefaults standardUserDefaults] setObject:val forKey:key];
|
||||
[preferencesDict setObject:val forKey:key];
|
||||
}
|
||||
|
||||
- (void)setEditorSizeEnabled:(BOOL)yn
|
||||
{
|
||||
if (yn)
|
||||
{
|
||||
[editorLinesField setEnabled:YES];
|
||||
[editorLinesField setTextColor:[NSColor blackColor]];
|
||||
[editorLinesField setEditable:YES];
|
||||
[editorColumnsField setEnabled:YES];
|
||||
[editorColumnsField setTextColor:[NSColor blackColor]];
|
||||
[editorColumnsField setEditable:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
[editorLinesField setEnabled:NO];
|
||||
[editorLinesField setTextColor:[NSColor darkGrayColor]];
|
||||
[editorLinesField setEditable:NO];
|
||||
[editorColumnsField setEnabled:NO];
|
||||
[editorColumnsField setTextColor:[NSColor darkGrayColor]];
|
||||
[editorColumnsField setEditable:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setRememberWindows:(id)sender
|
||||
{
|
||||
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (rememberWindows == nil)
|
||||
{
|
||||
rememberWindows = sender;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ([sender state])
|
||||
{
|
||||
case 0:
|
||||
[def setObject:@"NO" forKey:RememberWindows];
|
||||
break;
|
||||
case 1:
|
||||
[def setObject:@"YES" forKey:RememberWindows];
|
||||
break;
|
||||
}
|
||||
[def synchronize];
|
||||
|
||||
[preferencesDict setObject:[def objectForKey:RememberWindows]
|
||||
forKey:RememberWindows];
|
||||
}
|
||||
|
||||
- (void)setDisplayLog:(id)sender
|
||||
{
|
||||
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (displayLog == nil)
|
||||
{
|
||||
displayLog = sender;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ([sender state])
|
||||
{
|
||||
case 0:
|
||||
[def setObject:@"NO" forKey:DisplayLog];
|
||||
break;
|
||||
case 1:
|
||||
[def setObject:@"YES" forKey:DisplayLog];
|
||||
break;
|
||||
}
|
||||
[def synchronize];
|
||||
|
||||
[preferencesDict setObject:[def objectForKey:DisplayLog]
|
||||
forKey:DisplayLog];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2000-2004 Free Software Foundation
|
||||
Copyright (C) 2000-2014 Free Software Foundation
|
||||
|
||||
Authors: Philippe C.D. Robert
|
||||
Serg Stoyan
|
||||
|
@ -20,38 +20,51 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
// TODO: Split into several files with categories
|
||||
// TODO: Take care of Libraries(gnustep-gui, gnustep-base)
|
||||
// and Non Project Files
|
||||
|
||||
#include <ProjectCenter/PCFileManager.h>
|
||||
#include <ProjectCenter/PCProjectManager.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCFileManager.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
|
||||
#include <ProjectCenter/PCProjectWindow.h>
|
||||
#include <ProjectCenter/PCProjectBrowser.h>
|
||||
#include <ProjectCenter/PCProjectLoadedFiles.h>
|
||||
#import <ProjectCenter/PCProjectWindow.h>
|
||||
#import <ProjectCenter/PCProjectBrowser.h>
|
||||
#import <ProjectCenter/PCProjectLoadedFiles.h>
|
||||
|
||||
#include <ProjectCenter/PCProjectInspector.h>
|
||||
#include <ProjectCenter/PCProjectBuilder.h>
|
||||
#include <ProjectCenter/PCProjectEditor.h>
|
||||
#include <ProjectCenter/PCProjectLauncher.h>
|
||||
#import <ProjectCenter/PCProjectInspector.h>
|
||||
#import <ProjectCenter/PCProjectBuilder.h>
|
||||
#import <ProjectCenter/PCProjectEditor.h>
|
||||
#import <ProjectCenter/PCProjectLauncher.h>
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
#include <Protocols/CodeEditor.h>
|
||||
#import <Protocols/CodeEditor.h>
|
||||
|
||||
#import "Modules/Preferences/Saving/PCSavingPrefs.h"
|
||||
#import "Modules/Preferences/Misc/PCMiscPrefs.h"
|
||||
|
||||
// #import <AppKit/NSFileWrapper.h>
|
||||
// #import <Foundation/NSData.h>
|
||||
|
||||
NSString
|
||||
*PCProjectDictDidChangeNotification = @"PCProjectDictDidChangeNotification";
|
||||
NSString
|
||||
*PCProjectDictDidSaveNotification = @"PCProjectDictDidSaveNotification";
|
||||
NSString
|
||||
*PCProjectBreakpointNotification = @"PCProjectBreakpointNotification";
|
||||
|
||||
@implementation PCProject
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat: @"%@: %@ (%@)", [self className], projectName, projectPath];
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ==== Init and free
|
||||
// ============================================================================
|
||||
|
@ -76,18 +89,54 @@ NSString
|
|||
return self;
|
||||
}
|
||||
|
||||
- (PCProject *)openWithDictionaryAt:(NSString *)path
|
||||
- (PCProject *)openWithWrapperAt:(NSString *)aPath
|
||||
{
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
|
||||
BOOL isDir = NO;
|
||||
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath: aPath
|
||||
isDirectory: &isDir];
|
||||
if(isDir && exists)
|
||||
{
|
||||
projectFileWrapper = [[NSFileWrapper alloc] initWithPath: aPath];
|
||||
if(projectFileWrapper != nil)
|
||||
{
|
||||
NSDictionary *wrappers = [projectFileWrapper fileWrappers];
|
||||
NSData *data = [[wrappers objectForKey: @"PC.project"] regularFileContents];
|
||||
NSData *userData = [[wrappers objectForKey: [NSUserName() stringByAppendingPathExtension: @"project"]]
|
||||
regularFileContents];
|
||||
NSMutableDictionary *dict = [[[[NSString alloc] initWithData: data
|
||||
encoding: NSASCIIStringEncoding]
|
||||
propertyList] mutableCopy];
|
||||
NSDictionary *udict = [[[NSString alloc] initWithData: userData
|
||||
encoding: NSASCIIStringEncoding]
|
||||
propertyList];
|
||||
|
||||
[self assignProjectDict:dict atPath:path];
|
||||
if (udict != nil)
|
||||
[dict addEntriesFromDictionary: udict];
|
||||
[udict release];
|
||||
[self assignProjectDict:dict atPath: aPath];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile: aPath];
|
||||
|
||||
projectFileWrapper = [[NSFileWrapper alloc]
|
||||
initDirectoryWithFileWrappers:
|
||||
[NSMutableDictionary dictionaryWithCapacity: 3]];
|
||||
[projectFileWrapper addRegularFileWithContents:
|
||||
[NSData dataWithBytes: [[dict description] cString]
|
||||
length: [[dict description] length]]
|
||||
preferredFilename: @"PC.project"];
|
||||
[self assignProjectDict: dict
|
||||
atPath: aPath];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
#ifdef DEVELOPMENT
|
||||
#ifdef DEBUG
|
||||
NSLog (@"PCProject %@: dealloc", projectName);
|
||||
#endif
|
||||
|
||||
|
@ -105,8 +154,8 @@ NSString
|
|||
RELEASE(projectBrowser);
|
||||
RELEASE(projectLoadedFiles);
|
||||
RELEASE(projectEditor);
|
||||
if (projectBuilder) RELEASE(projectBuilder);
|
||||
if (projectLauncher) RELEASE(projectLauncher);
|
||||
TEST_RELEASE(projectBuilder);
|
||||
TEST_RELEASE(projectLauncher);
|
||||
|
||||
if (isSubproject == YES)
|
||||
{
|
||||
|
@ -117,6 +166,14 @@ NSString
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)loadPreferences:(NSNotification *)aNotification
|
||||
{
|
||||
id <PCPreferences> prefs = [projectManager prefController];
|
||||
|
||||
rememberWindows = [prefs boolForKey:RememberWindows];
|
||||
keepBackup = [prefs boolForKey:KeepBackup];
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ==== Project handling
|
||||
// ============================================================================
|
||||
|
@ -124,9 +181,11 @@ NSString
|
|||
// --- Dictionary
|
||||
- (BOOL)assignProjectDict:(NSDictionary *)pDict atPath:(NSString *)pPath
|
||||
{
|
||||
NSString *tempPath = nil;
|
||||
|
||||
NSAssert(pDict,@"No valid project dictionary!");
|
||||
|
||||
PCLogStatus(self, @"assignProjectDict");
|
||||
PCLogStatus(self, @"assignProjectDict at %@", pPath);
|
||||
|
||||
if (projectDict)
|
||||
{
|
||||
|
@ -135,17 +194,21 @@ NSString
|
|||
projectDict = [[NSMutableDictionary alloc] initWithDictionary:pDict];
|
||||
|
||||
// Project path
|
||||
if ([[pPath lastPathComponent] isEqualToString:@"PC.project"])
|
||||
if ([[pPath lastPathComponent] isEqualToString:@"PC.project"] ||
|
||||
[[[pPath lastPathComponent] pathExtension] isEqualToString:@"pcproj"])
|
||||
{
|
||||
[self setProjectPath:[pPath stringByDeletingLastPathComponent]];
|
||||
tempPath = [pPath stringByDeletingLastPathComponent];
|
||||
if ([[tempPath pathExtension] isEqualToString:@"pcproj"])
|
||||
{
|
||||
tempPath = [tempPath stringByDeletingLastPathComponent];
|
||||
}
|
||||
[self setProjectPath:tempPath];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setProjectPath:pPath];
|
||||
}
|
||||
|
||||
[projectDict setObject:[NSUserDefaults userLanguages] forKey:PCUserLanguages];
|
||||
|
||||
[self setProjectName:[projectDict objectForKey:PCProjectName]];
|
||||
[self writeMakefile];
|
||||
[self save];
|
||||
|
@ -173,6 +236,7 @@ NSString
|
|||
{
|
||||
if ([aDict objectForKey:key] == nil)
|
||||
{
|
||||
PCLogInfo(self, @"invalid dict entry for key %@", key);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
@ -186,8 +250,10 @@ NSString
|
|||
{
|
||||
[self updateProjectDict];
|
||||
|
||||
NSRunAlertPanel(@"Project updated!",
|
||||
@"The project file was converted from previous version!\nPlease make sure that every project attribute contain valid values!",
|
||||
NSRunAlertPanel(@"Open Project!",
|
||||
@"The project file was converted from previous version!\n"
|
||||
@"Please make sure that every project attribute contain"
|
||||
@" valid values!",
|
||||
@"OK",nil,nil);
|
||||
}
|
||||
}
|
||||
|
@ -315,26 +381,24 @@ NSString
|
|||
|
||||
- (BOOL)saveProjectWindowsAndPanels
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
NSMutableDictionary *windows = [NSMutableDictionary dictionary];
|
||||
NSString *projectFile = nil;
|
||||
NSMutableDictionary *projectFileDict = nil;
|
||||
|
||||
projectFile = [projectPath stringByAppendingPathComponent:@"PC.project"];
|
||||
projectFileDict = [NSMutableDictionary
|
||||
dictionaryWithContentsOfFile:projectFile];
|
||||
projectFile = [NSUserName() stringByAppendingPathExtension:@"project"];
|
||||
projectFileDict = [[NSMutableDictionary alloc] initWithCapacity:4];
|
||||
|
||||
// Project Window
|
||||
[windows setObject:[projectWindow stringWithSavedFrame]
|
||||
forKey:@"ProjectWindow"];
|
||||
if ([projectWindow isToolbarVisible] == YES)
|
||||
{
|
||||
[windows setObject:[NSString stringWithString:@"YES"]
|
||||
[windows setObject:@"YES"
|
||||
forKey:@"ShowToolbar"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[windows setObject:[NSString stringWithString:@"NO"]
|
||||
[windows setObject:@"NO"
|
||||
forKey:@"ShowToolbar"];
|
||||
}
|
||||
|
||||
|
@ -342,15 +406,15 @@ NSString
|
|||
[windows setObject:NSStringFromRect([[projectBrowser view] frame])
|
||||
forKey:@"ProjectBrowser"];
|
||||
|
||||
// Write to file and exit if prefernces wasn't set to save panels
|
||||
if (![[ud objectForKey:RememberWindows] isEqualToString:@"YES"])
|
||||
// Write to file and exit if preferences wasn't set to save panels
|
||||
if (!rememberWindows)
|
||||
{
|
||||
[projectFileDict setObject:windows forKey:@"PC_WINDOWS"];
|
||||
[projectFileDict setObject:windows forKey:PCWindows];
|
||||
[projectFileDict writeToFile:projectFile atomically:YES];
|
||||
[projectFileDict release];
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
// Project Build
|
||||
if (projectBuilder && [[projectManager buildPanel] isVisible])
|
||||
{
|
||||
|
@ -373,17 +437,6 @@ NSString
|
|||
[windows removeObjectForKey:@"ProjectLaunch"];
|
||||
}
|
||||
|
||||
// Project Inspector
|
||||
/* if ([[projectManager inspectorPanel] isVisible])
|
||||
{
|
||||
[windows setObject:[[projectManager inspectorPanel] stringWithSavedFrame]
|
||||
forKey:@"ProjectInspector"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[windows removeObjectForKey:@"ProjectInspector"];
|
||||
}*/
|
||||
|
||||
// Loaded Files
|
||||
if (projectLoadedFiles && [[projectManager loadedFilesPanel] isVisible])
|
||||
{
|
||||
|
@ -398,28 +451,52 @@ NSString
|
|||
|
||||
// Set to project dict for case if project changed
|
||||
// Don't notify about projectDict changes
|
||||
[projectDict setObject:windows forKey:@"PC_WINDOWS"];
|
||||
[projectDict setObject:windows forKey:PCWindows];
|
||||
|
||||
// Now save it directly to PC.project file
|
||||
[projectFileDict setObject:windows forKey:@"PC_WINDOWS"];
|
||||
[projectFileDict writeToFile:projectFile atomically:YES];
|
||||
// Now save it directly to username.project file
|
||||
[projectFileDict setObject:windows forKey:PCWindows];
|
||||
|
||||
// PCLogInfo(self, @"Windows and geometries saved");
|
||||
[projectFileDict setObject: [[NSCalendarDate date] description]
|
||||
forKey: PCLastEditing];
|
||||
|
||||
// add the file and write the wrapper.
|
||||
[projectFileWrapper addRegularFileWithContents:
|
||||
[NSData dataWithBytes: [[projectFileDict description] cString]
|
||||
length: [[projectFileDict description] length]]
|
||||
preferredFilename: projectFile];
|
||||
[projectFileWrapper writeToFile: wrapperPath
|
||||
atomically: YES
|
||||
updateFilenames: YES];
|
||||
|
||||
// release
|
||||
[projectFileDict release];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)save
|
||||
{
|
||||
NSString *file = [projectPath stringByAppendingPathComponent:@"PC.project"];
|
||||
NSString *backup = [file stringByAppendingPathExtension:@"backup"];
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSString *keepBackup = [defs objectForKey:KeepBackup];
|
||||
BOOL shouldKeep = [keepBackup isEqualToString:@"YES"];
|
||||
int spCount = [loadedSubprojects count];
|
||||
NSUInteger spCount = [loadedSubprojects count];
|
||||
int i;
|
||||
NSString *wrapperFile;
|
||||
NSString *file = @"PC.project";
|
||||
NSString *backup;
|
||||
NSMutableDictionary *dict = [projectDict mutableCopy];
|
||||
NSData *dictData = nil;
|
||||
|
||||
// remove key..
|
||||
[dict removeObjectForKey: PCWindows];
|
||||
[dict removeObjectForKey: PCLastEditing];
|
||||
|
||||
// initialize the wrappers..
|
||||
wrapperFile = [projectName stringByAppendingPathExtension: @"pcproj"];
|
||||
projectFileWrapper = [[NSFileWrapper alloc] initDirectoryWithFileWrappers:
|
||||
[NSMutableDictionary dictionaryWithCapacity: 3]];
|
||||
wrapperPath = [projectPath stringByAppendingPathComponent: wrapperFile];
|
||||
backup = [wrapperPath stringByAppendingPathExtension:@"backup"];
|
||||
|
||||
// load subprojects...
|
||||
for (i = 0; i < spCount; i++)
|
||||
{
|
||||
[[loadedSubprojects objectAtIndex:i] save];
|
||||
|
@ -428,29 +505,41 @@ NSString
|
|||
// Remove backup file if exists
|
||||
if ([fm fileExistsAtPath:backup] && ![fm removeFileAtPath:backup handler:nil])
|
||||
{
|
||||
NSRunAlertPanel(@"Save project",
|
||||
@"Error removing the old project backup!",
|
||||
NSRunAlertPanel(@"Save Project",
|
||||
@"Couldn't remove the old project backup file",
|
||||
@"OK",nil,nil);
|
||||
[dict release];
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Save backup
|
||||
if (shouldKeep == YES && [fm isReadableFileAtPath:file])
|
||||
if ((keepBackup == YES) && [fm isReadableFileAtPath: wrapperPath])
|
||||
{
|
||||
if ([fm copyPath:file toPath:backup handler:nil] == NO)
|
||||
if ([fm copyPath: wrapperPath
|
||||
toPath: backup
|
||||
handler:nil] == NO)
|
||||
{
|
||||
NSRunAlertPanel(@"Save project",
|
||||
@"Error when saving project backup file!",
|
||||
NSRunAlertPanel(@"Save Project",
|
||||
@"Couldn't save project backup file",
|
||||
@"OK",nil,nil);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
// Save project file
|
||||
[projectDict setObject:[[NSCalendarDate date] description]
|
||||
forKey:PCLastEditing];
|
||||
if ([projectDict writeToFile:file atomically:YES] == NO)
|
||||
dictData = [NSPropertyListSerialization dataFromPropertyList: dict
|
||||
format: NSPropertyListOpenStepFormat
|
||||
errorDescription: NULL];
|
||||
[projectFileWrapper addRegularFileWithContents: dictData
|
||||
preferredFilename: file];
|
||||
if ([projectFileWrapper
|
||||
writeToFile:wrapperPath
|
||||
atomically:YES
|
||||
updateFilenames: YES] == NO)
|
||||
{
|
||||
NSRunAlertPanel(@"Save Project",
|
||||
@"Couldn't save project file",
|
||||
@"OK",nil,nil,projectName);
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -461,9 +550,9 @@ NSString
|
|||
// Save GNUmakefile
|
||||
if ([self writeMakefile] == NO)
|
||||
{
|
||||
NSRunAlertPanel(@"Save project",
|
||||
@"Error when writing makefile for project %@",
|
||||
@"OK",nil,nil,projectName);
|
||||
NSRunAlertPanel(@"Save Project",
|
||||
@"Couldn't write GNUmakefile",
|
||||
@"OK",nil,nil);
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -487,9 +576,9 @@ NSString
|
|||
{
|
||||
int ret;
|
||||
|
||||
ret = NSRunAlertPanel(@"Alert",
|
||||
ret = NSRunAlertPanel(@"Close Project",
|
||||
@"Project or subprojects are modified",
|
||||
@"Save and Close",@"Don't save",@"Cancel");
|
||||
@"Save and Close",@"Don't save",@"Stop");
|
||||
switch (ret)
|
||||
{
|
||||
case NSAlertDefaultReturn:
|
||||
|
@ -519,6 +608,7 @@ NSString
|
|||
|
||||
if (isSubproject == YES)
|
||||
{
|
||||
[projectManager closeProject:self];
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -529,12 +619,6 @@ NSString
|
|||
return NO;
|
||||
}
|
||||
|
||||
// Project Builder
|
||||
/* if (projectBuilder)
|
||||
{
|
||||
[projectBuilder release];
|
||||
}*/
|
||||
|
||||
// Project window
|
||||
if (sender != projectWindow)
|
||||
{
|
||||
|
@ -586,6 +670,13 @@ NSString
|
|||
{
|
||||
projectWindow = [[PCProjectWindow alloc] initWithProject:self];
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(loadPreferences:)
|
||||
name:PCPreferencesDidChangeNotification
|
||||
object:nil];
|
||||
[self loadPreferences:nil];
|
||||
}
|
||||
|
||||
- (PCProjectWindow *)projectWindow
|
||||
|
@ -680,14 +771,21 @@ NSString
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (NSString *)execToolName
|
||||
{
|
||||
return [[self projectBundleInfoTable] objectForKey:@"ExecToolName"];
|
||||
}
|
||||
|
||||
- (NSArray *)buildTargets
|
||||
{
|
||||
return [[self projectBundleInfoTable] objectForKey:@"BuildTargets"];
|
||||
NSArray *buildTargets = [projectDict objectForKey:PCBuilderTargets];
|
||||
|
||||
if (!buildTargets)
|
||||
{
|
||||
buildTargets =
|
||||
[[self projectBundleInfoTable] objectForKey:@"BuildTargets"];
|
||||
[self setProjectDictObject:buildTargets
|
||||
forKey:PCBuilderTargets
|
||||
notify:NO];
|
||||
}
|
||||
|
||||
return buildTargets;
|
||||
}
|
||||
|
||||
- (NSArray *)sourceFileKeys
|
||||
|
@ -882,7 +980,7 @@ NSString
|
|||
{
|
||||
if ([key isEqualToString:PCClasses])
|
||||
{
|
||||
return [NSArray arrayWithObjects:@"m",nil];
|
||||
return [NSArray arrayWithObjects:@"m",@"mm",nil];
|
||||
}
|
||||
else if ([key isEqualToString:PCHeaders])
|
||||
{
|
||||
|
@ -894,7 +992,7 @@ NSString
|
|||
}
|
||||
else if ([key isEqualToString:PCInterfaces])
|
||||
{
|
||||
return [NSArray arrayWithObjects:@"gmodel",@"gorm", @"gsmarkup", nil];
|
||||
return [NSArray arrayWithObjects:@"gmodel",@"gorm", @"gsmarkup", @"nib", nil];
|
||||
}
|
||||
else if ([key isEqualToString:PCImages])
|
||||
{
|
||||
|
@ -906,7 +1004,7 @@ NSString
|
|||
}
|
||||
else if ([key isEqualToString:PCLibraries])
|
||||
{
|
||||
return [NSArray arrayWithObjects:@"so",@"a",@"lib",nil];
|
||||
return [NSArray arrayWithObjects:@"so",@"a",@"lib",@"dylib",nil];
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
@ -956,11 +1054,11 @@ NSString
|
|||
{
|
||||
if ([type isEqualToString:@"m"] || [type isEqualToString:@"c"])
|
||||
{
|
||||
return [NSString stringWithString:@"h"];
|
||||
return @"h";
|
||||
}
|
||||
else if ([type isEqualToString:@"h"])
|
||||
{
|
||||
return [NSString stringWithString:@"m"];
|
||||
return @"m";
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
@ -1143,9 +1241,9 @@ NSString
|
|||
{
|
||||
if (![fileManager copyFiles:fileList intoDirectory:directory])
|
||||
{
|
||||
NSRunAlertPanel(@"Alert",
|
||||
@"Error adding files to project %@!",
|
||||
@"OK", nil, nil, projectName);
|
||||
NSRunAlertPanel(@"Add File(s)",
|
||||
@"Error adding files %@ to project %@!",
|
||||
@"OK", nil, nil, fileList, projectName);
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -1154,9 +1252,9 @@ NSString
|
|||
if (![fileManager copyFiles:complementaryFiles
|
||||
intoDirectory:complementaryDir])
|
||||
{
|
||||
NSRunAlertPanel(@"Alert",
|
||||
@"Error adding complementary files to project %@!",
|
||||
@"OK", nil, nil, projectName);
|
||||
NSRunAlertPanel(@"Add File(s)",
|
||||
@"Error adding files %@ to project %@!",
|
||||
@"OK", nil, nil, complementaryFiles, projectName);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
@ -1370,10 +1468,13 @@ NSString
|
|||
|
||||
_editorCategory = [[_editor categoryPath] mutableCopy];
|
||||
range = [_editorCategory rangeOfString:fromFile];
|
||||
[_editorCategory replaceCharactersInRange:range withString:toFile];
|
||||
if (range.location != NSNotFound)
|
||||
{
|
||||
[_editorCategory replaceCharactersInRange:range withString:toFile];
|
||||
|
||||
[_editor setCategoryPath:_editorCategory];
|
||||
[projectBrowser setPath:_editorCategory];
|
||||
[_editor setCategoryPath:_editorCategory];
|
||||
[projectBrowser setPath:_editorCategory];
|
||||
}
|
||||
RELEASE(_editorCategory);
|
||||
}
|
||||
else
|
||||
|
@ -1437,7 +1538,7 @@ NSString
|
|||
int i;
|
||||
PCProject *sp = nil;
|
||||
NSString *spName = nil;
|
||||
NSString *spFile = nil;
|
||||
NSString *spPath = nil;
|
||||
|
||||
// Subproject in project but not loaded
|
||||
if ([[projectDict objectForKey:PCSubprojects] containsObject:name])
|
||||
|
@ -1459,12 +1560,10 @@ NSString
|
|||
// Subproject not found in array, load it
|
||||
if (sp == nil)
|
||||
{
|
||||
spFile = [projectPath stringByAppendingPathComponent:name];
|
||||
spFile = [spFile stringByAppendingPathExtension:@"subproj"];
|
||||
spFile = [spFile stringByAppendingPathComponent:@"PC.project"];
|
||||
/* PCLogInfo(self, @"Not found! Load subproject: %@ at path: %@",
|
||||
name, spFile);*/
|
||||
sp = [projectManager loadProjectAt:spFile];
|
||||
spPath = [projectPath stringByAppendingPathComponent:name];
|
||||
spPath = [spPath stringByAppendingPathExtension:@"subproj"];
|
||||
|
||||
sp = [projectManager openProjectAt:spPath makeActive:NO];
|
||||
if (sp)
|
||||
{
|
||||
[sp setIsSubproject:YES];
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
|
@ -33,6 +33,8 @@
|
|||
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
#import "Modules/Preferences/Misc/PCMiscPrefs.h"
|
||||
|
||||
NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
||||
|
||||
@implementation PCProjectBrowser
|
||||
|
@ -105,8 +107,9 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
// NSLog(@"---> Selected: %@: category: %@", name, category);
|
||||
|
||||
if ([[browser selectedCells] count] != 1
|
||||
|| [name isEqualToString:category])
|
||||
if ([[browser selectedCells] count] != 1 ||
|
||||
!category ||
|
||||
[name isEqualToString:category])
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
@ -140,7 +143,12 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
return path;
|
||||
}
|
||||
|
||||
// Returns nil of multiple categories selected
|
||||
// Returns 'nil' if selected:
|
||||
// - root project (browser path is @"/")
|
||||
// - multiple categories
|
||||
// - name of subproject
|
||||
// Should not call any of the nameOf... or pathTo... methods to prevent
|
||||
// cyclic recursion.
|
||||
- (NSString *)nameOfSelectedCategory
|
||||
{
|
||||
NSArray *pathArray = [[browser path] componentsSeparatedByString:@"/"];
|
||||
|
@ -150,11 +158,19 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
NSString *name = nil;
|
||||
int i;
|
||||
|
||||
if ([lastPathElement isEqualToString:[activeProject projectName]])
|
||||
// Name of subproject selected: Change active project to superproject
|
||||
// to check category against superproject's catgory list.
|
||||
// But: path '/Subproject/Foo' and '/Subprojects/Foo/Subprojects' will
|
||||
// return the same category 'Subprojects' and active project will be 'Foo'
|
||||
// in both cases
|
||||
// ![[self nameOfSelectedFile] isEqualToString:lastPathElement])
|
||||
/* if ([lastPathElement isEqualToString:[activeProject projectName]])
|
||||
{
|
||||
return [activeProject projectName];
|
||||
}
|
||||
activeProject = [activeProject superProject];
|
||||
rootCategories = [activeProject rootCategories];
|
||||
}*/
|
||||
|
||||
// Multiple categories selected
|
||||
if (([rootCategories containsObject:lastPathElement]
|
||||
&& [[browser selectedCells] count] > 1))
|
||||
{
|
||||
|
@ -170,6 +186,13 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
}
|
||||
}
|
||||
|
||||
// Subproject's name selected
|
||||
if ([name isEqualToString:@"Subprojects"] &&
|
||||
[lastPathElement isEqualToString:[activeProject projectName]])
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@ -285,11 +308,11 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
- (void)reloadLastColumnAndNotify:(BOOL)yn
|
||||
{
|
||||
int column = [browser lastColumn];
|
||||
NSInteger column = [browser lastColumn];
|
||||
NSString *category = [self nameOfSelectedCategory];
|
||||
int selectedColumn = [browser selectedColumn];
|
||||
NSInteger selectedColumn = [browser selectedColumn];
|
||||
NSMatrix *colMatrix = [browser matrixInColumn:selectedColumn];
|
||||
int rowCount = 0, colCount = 0, spCount = 0;
|
||||
NSInteger rowCount = 0, colCount = 0, spCount = 0;
|
||||
PCProject *activeProject = [[project projectManager] activeProject];
|
||||
NSString *selCellTitle = [[browser selectedCell] stringValue];
|
||||
|
||||
|
@ -357,32 +380,34 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
- (void)click:(id)sender
|
||||
{
|
||||
NSUserDefaults *ud;
|
||||
NSString *category;
|
||||
PCProject *activeProject;
|
||||
NSString *browserPath;
|
||||
NSString *filePath;
|
||||
NSString *category;
|
||||
PCProject *activeProject;
|
||||
NSString *browserPath;
|
||||
NSString *filePath;
|
||||
NSString *fileName;
|
||||
|
||||
if (sender != browser)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ud = [NSUserDefaults standardUserDefaults];
|
||||
category = [self nameOfSelectedCategory];
|
||||
activeProject = [[project projectManager] activeProject];
|
||||
browserPath = [self path];
|
||||
filePath = [self pathToSelectedFile];
|
||||
fileName = [self nameOfSelectedFile];
|
||||
|
||||
// NSLog(@"browserPath: %@ forProject: %@",
|
||||
// browserPath, [activeProject projectName]);
|
||||
NSLog(@"[click] category: %@ forProject: %@ fileName: %@",
|
||||
category, [activeProject projectName], fileName);
|
||||
|
||||
// if ([[self selectedFiles] count] == 1
|
||||
// ![fileName isEqualToString:[activeProject projectName]] &&
|
||||
if (filePath &&
|
||||
[filePath isEqualToString:browserPath] &&
|
||||
![[ud objectForKey:SeparateEditor] isEqualToString:@"YES"])
|
||||
category &&
|
||||
![category isEqualToString:@"Libraries"]
|
||||
)
|
||||
{
|
||||
// NSLog(@"[click] category: %@ filePath: %@", category, filePath);
|
||||
NSLog(@"[click] category: %@ filePath: %@", category, filePath);
|
||||
[[activeProject projectEditor] openEditorForCategoryPath:browserPath
|
||||
windowed:NO];
|
||||
}
|
||||
|
@ -394,23 +419,22 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
- (void)doubleClick:(id)sender
|
||||
{
|
||||
NSString *category = [self nameOfSelectedCategory];
|
||||
id selectedCell;
|
||||
NSString *category;
|
||||
NSString *fileName;
|
||||
PCProject *activeProject;
|
||||
NSString *key;
|
||||
NSString *filePath;
|
||||
id <PCPreferences> prefs = [[project projectManager] prefController];
|
||||
NSWorkspace *workspace;
|
||||
NSString *appName, *type;
|
||||
|
||||
if ((sender != browser) ||
|
||||
[[self nameOfSelectedCategory] isEqualToString:@"Libraries"])
|
||||
if ((sender != browser) || [category isEqualToString:@"Libraries"])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
selectedCell = [sender selectedCell];
|
||||
category = [self nameOfSelectedCategory];
|
||||
fileName = [[sender selectedCell] stringValue];
|
||||
activeProject = [[project projectManager] activeProject];
|
||||
key = [activeProject keyForCategory:category];
|
||||
|
@ -418,21 +442,36 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
if ([self nameOfSelectedFile] != nil)
|
||||
{
|
||||
/* PCLogInfo(self, @"{doubleClick} filePath: %@", filePath);*/
|
||||
BOOL foundFile = NO;
|
||||
BOOL foundApp = NO;
|
||||
// PCLogInfo(self, @"{doubleClick} filePath: %@", filePath);*/
|
||||
|
||||
workspace = [NSWorkspace sharedWorkspace];
|
||||
[workspace getInfoForFile:filePath application:&appName type:&type];
|
||||
// NSLog (@"Open file: %@ with app: %@", filePath, appName);
|
||||
foundFile = [workspace getInfoForFile:filePath
|
||||
application:&appName
|
||||
type:&type];
|
||||
foundApp = foundFile && appName;
|
||||
// NSLog (@"Open file: %@ with app: %@", filePath, appName);
|
||||
|
||||
// If 'Editor' role was set in .GNUstepExtPrefs application
|
||||
// name will be returned according that setting. Otherwise
|
||||
// 'ProjectCenter.app' will be returned accoring to NSTypes
|
||||
// from Info-gnustep.plist file of PC.
|
||||
if (appName == nil ||
|
||||
[appName isEqualToString:@"ProjectCenter.app"])
|
||||
if(foundApp == NO || [appName isEqualToString:@"ProjectCenter.app"])
|
||||
{
|
||||
[[project projectEditor] openEditorForCategoryPath:[browser path]
|
||||
windowed:YES];
|
||||
appName = [prefs stringForKey:Editor];
|
||||
|
||||
if (![appName isEqualToString:@"ProjectCenter"])
|
||||
{
|
||||
[workspace openFile:filePath
|
||||
withApplication:appName];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[activeProject projectEditor]
|
||||
openEditorForCategoryPath:[self path]
|
||||
windowed:YES];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -490,13 +529,13 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
@implementation PCProjectBrowser (ProjectBrowserDelegate)
|
||||
|
||||
- (void) browser:(NSBrowser *)sender
|
||||
createRowsForColumn:(int)column
|
||||
createRowsForColumn:(NSInteger)column
|
||||
inMatrix:(NSMatrix *)matrix
|
||||
{
|
||||
NSString *pathToCol;
|
||||
NSArray *files;
|
||||
int i = 0;
|
||||
int count = 0;
|
||||
NSString *pathToCol;
|
||||
NSArray *files;
|
||||
NSUInteger i = 0;
|
||||
NSUInteger count = 0;
|
||||
|
||||
if (sender != browser || !matrix || ![matrix isKindOfClass:[NSMatrix class]])
|
||||
{
|
||||
|
@ -560,11 +599,11 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
- (NSImage *)fileNameIconImage
|
||||
{
|
||||
NSString *categoryName = nil;
|
||||
NSString *fileName = nil;
|
||||
NSString *fileExtension = nil;
|
||||
NSString *iconName = nil;
|
||||
NSImage *icon = nil;
|
||||
NSString *categoryName = nil;
|
||||
NSString *fileName = nil;
|
||||
NSString *iconName = nil;
|
||||
NSImage *icon = nil;
|
||||
PCProject *activeProject = [[project projectManager] activeProject];
|
||||
|
||||
fileName = [self nameOfSelectedFile];
|
||||
if (fileName)
|
||||
|
@ -573,7 +612,6 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
{
|
||||
return icon;
|
||||
}
|
||||
fileExtension = [fileName pathExtension];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -587,7 +625,9 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
{
|
||||
iconName = [[NSString alloc] initWithString:@"MultiFiles"];
|
||||
}
|
||||
else if (!categoryName && !fileName) // Nothing selected
|
||||
// Nothing or subproject name selected
|
||||
else if ((!categoryName && !fileName) ||
|
||||
[fileName isEqualToString:[activeProject projectName]])
|
||||
{
|
||||
iconName = [[NSString alloc] initWithString:@"FileProject"];
|
||||
}
|
||||
|
@ -671,6 +711,15 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
return PCFileNameFieldNoFiles;
|
||||
}
|
||||
|
||||
- (NSString *)fileNameIconPath
|
||||
{
|
||||
NSString *fileName = [self nameOfSelectedFile];
|
||||
NSString *category = [self nameOfSelectedCategory];
|
||||
|
||||
return [project pathForFile:fileName
|
||||
forKey:[project keyForCategory:category]];
|
||||
}
|
||||
|
||||
- (BOOL)canPerformDraggingOf:(NSArray *)paths
|
||||
{
|
||||
NSString *category = [self nameOfSelectedCategory];
|
||||
|
@ -681,7 +730,7 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
NSLog(@"PCBrowser: canPerformDraggingOf -> %@", category);
|
||||
|
||||
if (!category)
|
||||
if (!category || ([self nameOfSelectedFile] != nil))
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
@ -691,6 +740,7 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
return NO;
|
||||
}
|
||||
|
||||
// Check if we can accept files of such types
|
||||
while ((s = [e nextObject]))
|
||||
{
|
||||
if (![fileTypes containsObject:[s pathExtension]])
|
||||
|
@ -702,4 +752,27 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)prepareForDraggingOf:(NSArray *)paths
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)performDraggingOf:(NSArray *)paths
|
||||
{
|
||||
NSString *category = [self nameOfSelectedCategory];
|
||||
NSString *categoryKey = [project keyForCategory:category];
|
||||
NSEnumerator *pathsEnum = [paths objectEnumerator];
|
||||
NSString *file = nil;
|
||||
|
||||
while ((file = [[pathsEnum nextObject] lastPathComponent]))
|
||||
{
|
||||
if (![project doesAcceptFile:file forKey:categoryKey])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
return [project addAndCopyFiles:paths forKey:categoryKey];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -20,7 +20,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#import <ProjectCenter/PCProjectBuilderOptions.h>
|
||||
|
@ -58,43 +58,36 @@
|
|||
{
|
||||
project = aProject;
|
||||
delegate = aDelegate;
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(loadProjectProperties:)
|
||||
name:PCProjectDictDidChangeNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
#ifdef DEBUG
|
||||
NSLog (@"PCProjectBuilderOptions: dealloc");
|
||||
#endif
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
NSArray *args;
|
||||
|
||||
// Setup target popup
|
||||
[targetPopup removeAllItems];
|
||||
[targetPopup addItemsWithTitles:[project buildTargets]];
|
||||
[targetPopup selectItemAtIndex:0];
|
||||
|
||||
// Setup build arguments field
|
||||
args = [[project projectDict] objectForKey:PCBuilderArguments];
|
||||
[buildArgsField setStringValue:[args componentsJoinedByString:@" "]];
|
||||
[optionsPanel makeFirstResponder:buildArgsField];
|
||||
|
||||
// Setup option buttons
|
||||
[verboseButton setRefusesFirstResponder:YES];
|
||||
[debugButton setRefusesFirstResponder:YES];
|
||||
[stripButton setRefusesFirstResponder:YES];
|
||||
[sharedLibsButton setRefusesFirstResponder:YES];
|
||||
|
||||
[self _setStateForButton:verboseButton
|
||||
key:PCBuilderVerbose
|
||||
defaultState:NSOffState];
|
||||
[self _setStateForButton:debugButton
|
||||
key:PCBuilderDebug
|
||||
defaultState:NSOnState];
|
||||
[self _setStateForButton:stripButton
|
||||
key:PCBuilderStrip
|
||||
defaultState:NSOffState];
|
||||
[self _setStateForButton:sharedLibsButton
|
||||
key:PCBuilderSharedLibs
|
||||
defaultState:NSOnState];
|
||||
[self loadProjectProperties:nil];
|
||||
}
|
||||
|
||||
- (void)show:(NSRect)builderRect
|
||||
|
@ -119,6 +112,7 @@
|
|||
[optionsPanel setFrame:opRect display:NO];
|
||||
|
||||
[optionsPanel makeKeyAndOrderFront:nil];
|
||||
[optionsPanel makeFirstResponder:buildArgsField];
|
||||
}
|
||||
|
||||
- (NSString *)buildTarget
|
||||
|
@ -149,7 +143,7 @@
|
|||
[args removeObject:@""];
|
||||
[args removeObject:@" "];
|
||||
|
||||
[project setProjectDictObject:args forKey:PCBuilderArguments notify:YES];
|
||||
[project setProjectDictObject:args forKey:PCBuilderArguments notify:NO];
|
||||
|
||||
[delegate targetDidSet:[targetPopup titleOfSelectedItem]];
|
||||
}
|
||||
|
@ -168,7 +162,35 @@
|
|||
if (sender == sharedLibsButton)
|
||||
key = PCBuilderSharedLibs;
|
||||
|
||||
[project setProjectDictObject:value forKey:key notify:YES];
|
||||
[project setProjectDictObject:value forKey:key notify:NO];
|
||||
}
|
||||
|
||||
- (void)loadProjectProperties:(NSNotification *)aNotif
|
||||
{
|
||||
NSArray *args;
|
||||
|
||||
// Setup target popup
|
||||
[targetPopup removeAllItems];
|
||||
[targetPopup addItemsWithTitles:[project buildTargets]];
|
||||
[targetPopup selectItemAtIndex:0];
|
||||
|
||||
// Setup build arguments field
|
||||
args = [[project projectDict] objectForKey:PCBuilderArguments];
|
||||
[buildArgsField setStringValue:[args componentsJoinedByString:@" "]];
|
||||
|
||||
// Setup option buttons
|
||||
[self _setStateForButton:verboseButton
|
||||
key:PCBuilderVerbose
|
||||
defaultState:NSOffState];
|
||||
[self _setStateForButton:debugButton
|
||||
key:PCBuilderDebug
|
||||
defaultState:NSOnState];
|
||||
[self _setStateForButton:stripButton
|
||||
key:PCBuilderStrip
|
||||
defaultState:NSOffState];
|
||||
[self _setStateForButton:sharedLibsButton
|
||||
key:PCBuilderSharedLibs
|
||||
defaultState:NSOnState];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -19,15 +19,17 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCProjectManager.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#include <ProjectCenter/PCProjectBuilder.h>
|
||||
#include <ProjectCenter/PCProjectBuilderPanel.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCProjectBuilder.h>
|
||||
#import <ProjectCenter/PCProjectBuilderPanel.h>
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
#import "Modules/Preferences/Misc/PCMiscPrefs.h"
|
||||
|
||||
@implementation PCProjectBuilderPanel
|
||||
|
||||
|
@ -92,11 +94,10 @@
|
|||
if (!([contentBox contentView] == builderView))
|
||||
{
|
||||
[contentBox setContentView:builderView];
|
||||
[contentBox display];
|
||||
}
|
||||
|
||||
/* PCLogInfo(self, @"orderFront: %@ -> %@",
|
||||
builderView, [builderView superview]);*/
|
||||
/* NSLog(self, @"orderFront: %@ -> %@",
|
||||
builderView, [builderView superview]);*/
|
||||
|
||||
[panel orderFront:self];
|
||||
}
|
||||
|
@ -114,8 +115,15 @@
|
|||
|
||||
- (void)activeProjectDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
PCProject *rootProject = [projectManager rootActiveProject];
|
||||
PCProject *rootProject;
|
||||
id <PCPreferences> prefs = [projectManager prefController];
|
||||
|
||||
if (![prefs boolForKey:UseTearOffWindows])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
rootProject = [projectManager rootActiveProject];
|
||||
if (rootProject == currentProject)
|
||||
{
|
||||
return;
|
||||
|
@ -123,9 +131,8 @@
|
|||
|
||||
currentProject = rootProject;
|
||||
|
||||
/* PCLogInfo(self, @"activeProjectDidChange to: %@",
|
||||
[rootProject projectName]);*/
|
||||
NSLog(@"activeProjectDidChange to: %@", [rootProject projectName]);
|
||||
// NSLog(@"Buider Panel: activeProjectDidChange to: %@",
|
||||
// [rootProject projectName]);
|
||||
|
||||
if (!rootProject)
|
||||
{
|
||||
|
@ -144,5 +151,12 @@
|
|||
return [panel isVisible];
|
||||
}
|
||||
|
||||
// --- Panel delgate
|
||||
- (BOOL)windowShouldClose:(id)sender
|
||||
{
|
||||
[contentBox setContentView:emptyBox];
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2002-2004 Free Software Foundation
|
||||
Copyright (C) 2002-2015 Free Software Foundation
|
||||
|
||||
Authors: Philippe C.D. Robert
|
||||
Serg Stoyan
|
||||
Riccardo Mottola
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
|
@ -20,7 +21,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
|
@ -176,13 +177,61 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (id<CodeEditor>) openEditorForFilePath: (NSString *)filePath
|
||||
windowed: (BOOL)windowed
|
||||
{
|
||||
PCProject *activeProject = [[_project projectManager] activeProject];
|
||||
NSString *fileName = [filePath lastPathComponent];
|
||||
BOOL editable = YES;
|
||||
id<CodeEditor> editor = nil;
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
|
||||
NSLog(@"PCPE: fileName: %@, filePath: %@, project: %@",
|
||||
fileName, filePath, [activeProject projectName]);
|
||||
|
||||
if (![mgr fileExistsAtPath: filePath])
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Determine if file should be opened for read only
|
||||
if (![_project isEditableFile:fileName])
|
||||
{
|
||||
editable = NO;
|
||||
}
|
||||
|
||||
// Set the 'editor' var either by requesting already opened
|
||||
// editor or by creating the new one.
|
||||
editor = [self openEditorForFile:filePath
|
||||
editable:editable
|
||||
windowed:windowed];
|
||||
if (!editor)
|
||||
{
|
||||
NSLog(@"We don't have editor for file: %@", fileName);
|
||||
[self setActiveEditor: nil];
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Category path was changed by user's clicking inside browser.
|
||||
// That's why new category path must be transfered to editor.
|
||||
NSString *categoryPath = [NSString stringWithFormat: @"/Classes/%@/", fileName];
|
||||
[editor setCategoryPath:categoryPath];
|
||||
[self orderFrontEditorForFile:filePath];
|
||||
|
||||
// Reload last column because editor has just been loaded
|
||||
[[_project projectBrowser] reloadLastColumnAndNotify:NO];
|
||||
[editor fileStructureItemSelected:fileName];
|
||||
|
||||
return editor;
|
||||
}
|
||||
|
||||
// Called by PCProjectBrowser
|
||||
// categoryPath:
|
||||
// 1. "/Classes/Class.m/- init"
|
||||
// 2. "/Subprojects/Project/Classes/Class.m/- init"
|
||||
// 3. "/Library/gnustep-gui"
|
||||
- (id<CodeEditor>)openEditorForCategoryPath:(NSString *)categoryPath
|
||||
windowed:(BOOL)windowed
|
||||
windowed:(BOOL)windowed
|
||||
{
|
||||
NSArray *pathArray = [categoryPath pathComponents];
|
||||
NSString *pathLastObject = [pathArray lastObject];
|
||||
|
@ -193,7 +242,6 @@
|
|||
NSString *filePath = nil;
|
||||
BOOL editable = YES;
|
||||
id<CodeEditor> editor;
|
||||
NSString *firstSymbol = nil;
|
||||
|
||||
fileName = [[[[_project projectBrowser] pathFromSelectedCategory]
|
||||
pathComponents] objectAtIndex:2];
|
||||
|
@ -212,25 +260,14 @@
|
|||
|
||||
// Set the 'editor' var either by requesting already opened
|
||||
// editor or by creating the new one.
|
||||
editor = [self editorForFile:filePath];
|
||||
if (editor)
|
||||
editor = [self openEditorForFile:filePath
|
||||
editable:editable
|
||||
windowed:windowed];
|
||||
if (!editor)
|
||||
{
|
||||
// It seems double click occured in browser
|
||||
if (windowed)
|
||||
{
|
||||
[editor setWindowed:windowed];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
editor = [self openEditorForFile:filePath
|
||||
editable:editable
|
||||
windowed:windowed];
|
||||
if (!editor)
|
||||
{
|
||||
NSLog(@"We don't have editor for file: %@", fileName);
|
||||
return nil;
|
||||
}
|
||||
NSLog(@"We don't have editor for file: %@", fileName);
|
||||
[self setActiveEditor: nil];
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Category path was changed by user's clicking inside browser.
|
||||
|
@ -238,13 +275,12 @@
|
|||
[editor setCategoryPath:categoryPath];
|
||||
[self orderFrontEditorForFile:filePath];
|
||||
|
||||
/* pathLastObject = [pathArray lastObject];
|
||||
NSLog(@"pathArray: c: %i %@", [pathArray count], pathArray);
|
||||
pathLastObject = [pathArray lastObject];
|
||||
/* NSLog(@"pathArray: c: %i %@", [pathArray count], pathArray);
|
||||
NSLog(@"pathArray: lastObject %@", [pathArray lastObject]);
|
||||
NSLog(@"lastObject[1]: %@",
|
||||
[pathLastObject substringWithRange:NSMakeRange(0,1)]);*/
|
||||
|
||||
firstSymbol = [pathLastObject substringToIndex:1];
|
||||
if ([pathLastObject isEqualToString:@"/"])
|
||||
{
|
||||
pathLastObject = [pathArray objectAtIndex:[pathArray count]-2];
|
||||
|
@ -291,112 +327,20 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Called by PCProject. After that retainCount goes down and [self dealloc]
|
||||
// called by autorelease mechanism
|
||||
- (BOOL)closeAllEditors
|
||||
{
|
||||
NSEnumerator *enumerator = [_editorsDict keyEnumerator];
|
||||
id<CodeEditor> editor;
|
||||
NSString *key = nil;
|
||||
NSMutableArray *editedFiles = [[NSMutableArray alloc] init];
|
||||
|
||||
while ((key = [enumerator nextObject]))
|
||||
{
|
||||
editor = [_editorsDict objectForKey:key];
|
||||
if ([editor isEdited])
|
||||
{
|
||||
[editedFiles addObject:[key lastPathComponent]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[editor closeFile:self save:YES];
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Order panel with list of changed files
|
||||
if ([editedFiles count])
|
||||
{
|
||||
if ([self saveEditedFiles:(NSArray *)editedFiles] == NO)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
[_editorsDict removeAllObjects];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ==== File handling
|
||||
// ===========================================================================
|
||||
|
||||
- (BOOL)saveEditedFiles:(NSArray *)files
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = NSRunAlertPanel(@"Alert",
|
||||
@"Project has modified files\n%@",
|
||||
@"Save and Close",@"Close",@"Don't close",
|
||||
files);
|
||||
switch (ret)
|
||||
{
|
||||
case NSAlertDefaultReturn:
|
||||
if ([self saveAllFiles] == NO)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
break;
|
||||
|
||||
case NSAlertAlternateReturn:
|
||||
// Close files without saving
|
||||
break;
|
||||
|
||||
case NSAlertOtherReturn:
|
||||
return NO;
|
||||
break;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
// TODO: move to PCEditorManager
|
||||
- (BOOL)saveAllFiles
|
||||
{
|
||||
NSEnumerator *enumerator = [_editorsDict keyEnumerator];
|
||||
id<CodeEditor> editor;
|
||||
NSString *key;
|
||||
BOOL ret = YES;
|
||||
|
||||
while ((key = [enumerator nextObject]))
|
||||
{
|
||||
editor = [_editorsDict objectForKey:key];
|
||||
|
||||
if ([editor saveFileIfNeeded] == NO)
|
||||
{
|
||||
ret = NO;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (BOOL)saveFileAs:(NSString *)file
|
||||
{
|
||||
id<CodeEditor> editor = [self activeEditor];
|
||||
NSString *categoryPath = nil;
|
||||
BOOL res;
|
||||
|
||||
if (editor != nil)
|
||||
{
|
||||
BOOL res;
|
||||
BOOL iw = [editor isWindowed];
|
||||
NSString *categoryPath = [editor categoryPath];
|
||||
|
||||
res = [editor saveFileTo:file];
|
||||
[editor closeFile:self save:NO];
|
||||
|
||||
editor = [self openEditorForFile:file
|
||||
editable:YES // fixme
|
||||
windowed:iw];
|
||||
categoryPath = [editor categoryPath];
|
||||
res = [super saveFileAs:file];
|
||||
[editor setCategoryPath:categoryPath];
|
||||
|
||||
return res;
|
||||
|
@ -440,7 +384,6 @@
|
|||
NSString *lastEditorKey = [[_editorsDict allKeys] lastObject];
|
||||
id<CodeEditor> lastEditor = [_editorsDict objectForKey:lastEditorKey];
|
||||
|
||||
lastEditorKey = [[_editorsDict allKeys] lastObject];
|
||||
[_componentView setContentView:[lastEditor componentView]];
|
||||
[[_project projectWindow] makeFirstResponder:[lastEditor editorView]];
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2000-2004 Free Software Foundation
|
||||
Copyright (C) 2000-2023 Free Software Foundation
|
||||
|
||||
Authors: Philippe C.D. Robert
|
||||
Serg Stoyan
|
||||
Riccardo Mottola
|
||||
German Arias
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
|
@ -20,7 +22,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
|
@ -29,7 +31,7 @@
|
|||
#import <ProjectCenter/PCProjectBrowser.h>
|
||||
#import <ProjectCenter/PCProjectWindow.h>
|
||||
#import <ProjectCenter/PCProjectInspector.h>
|
||||
|
||||
#import <ProjectCenter/PCFileManager.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
@implementation PCProjectInspector
|
||||
|
@ -86,6 +88,7 @@
|
|||
RELEASE(projectAttributesSubview);
|
||||
RELEASE(projectAttributesView);
|
||||
RELEASE(projectDescriptionView);
|
||||
RELEASE(projectLanguagesView);
|
||||
RELEASE(fileAttributesView);
|
||||
|
||||
RELEASE(inspectorPanel);
|
||||
|
@ -109,6 +112,8 @@
|
|||
// Panel
|
||||
[inspectorPanel setFrameAutosaveName:@"ProjectInspector"];
|
||||
[inspectorPanel setFrameUsingName:@"ProjectInspector"];
|
||||
project = [projectManager activeProject];
|
||||
projectDict = [project projectDict];
|
||||
|
||||
// PopUp
|
||||
[inspectorPopup selectItemAtIndex:0];
|
||||
|
@ -122,6 +127,9 @@
|
|||
// Project Description
|
||||
[self createProjectDescription];
|
||||
|
||||
// Project Languages
|
||||
[self createProjectLanguages];
|
||||
|
||||
// File Attributes
|
||||
[self createFileAttributes];
|
||||
|
||||
|
@ -159,16 +167,19 @@
|
|||
switch([sender indexOfSelectedItem])
|
||||
{
|
||||
case 0:
|
||||
[inspectorView setContentView: buildAttributesView];
|
||||
[inspectorView setContentView:buildAttributesView];
|
||||
break;
|
||||
case 1:
|
||||
[inspectorView setContentView: projectAttributesView];
|
||||
[inspectorView setContentView:projectAttributesView];
|
||||
break;
|
||||
case 2:
|
||||
[inspectorView setContentView: projectDescriptionView];
|
||||
[inspectorView setContentView:projectDescriptionView];
|
||||
break;
|
||||
case 3:
|
||||
[inspectorView setContentView: fileAttributesView];
|
||||
[inspectorView setContentView:projectLanguagesView];
|
||||
break;
|
||||
case 4:
|
||||
[inspectorView setContentView:fileAttributesView];
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -180,33 +191,35 @@
|
|||
NSString *newEntry = [sender stringValue];
|
||||
|
||||
// Build Atributes
|
||||
if (sender == installPathField)
|
||||
if (sender == installDomainPopup)
|
||||
{
|
||||
[project setProjectDictObject:newEntry forKey:PCInstallDir notify:YES];
|
||||
[project setProjectDictObject:newEntry
|
||||
forKey:PCInstallDomain
|
||||
notify:YES];
|
||||
}
|
||||
else if (sender == cppOptField)
|
||||
{
|
||||
[project setProjectDictObject:newEntry
|
||||
forKey:PCPreprocessorOptions
|
||||
notify:YES];
|
||||
forKey:PCPreprocessorOptions
|
||||
notify:YES];
|
||||
}
|
||||
else if (sender == objcOptField)
|
||||
{
|
||||
[project setProjectDictObject:newEntry
|
||||
forKey:PCObjCCompilerOptions
|
||||
notify:YES];
|
||||
notify:YES];
|
||||
}
|
||||
else if (sender == cOptField)
|
||||
{
|
||||
[project setProjectDictObject:newEntry
|
||||
forKey:PCCompilerOptions
|
||||
notify:YES];
|
||||
notify:YES];
|
||||
}
|
||||
else if (sender == ldOptField)
|
||||
{
|
||||
[project setProjectDictObject:newEntry
|
||||
forKey:PCLinkerOptions
|
||||
notify:YES];
|
||||
notify:YES];
|
||||
}
|
||||
// Project Description
|
||||
else if (sender == descriptionField)
|
||||
|
@ -224,8 +237,8 @@
|
|||
else if (sender == licDescriptionField)
|
||||
{
|
||||
[project setProjectDictObject:newEntry
|
||||
forKey:PCCopyrightDescription
|
||||
notify:YES];
|
||||
forKey:PCCopyrightDescription
|
||||
notify:YES];
|
||||
}
|
||||
else if (sender == urlField)
|
||||
{
|
||||
|
@ -241,8 +254,9 @@
|
|||
|
||||
// When user ends editing of text field with Tab or changing focus, entered
|
||||
// changes should be accepted. The exception is PCFileName fields. I'm not sure
|
||||
// if this is correct implementation (action is performed twice if user ends
|
||||
// editing with Enter key)
|
||||
// if this is correct implementation. Action is performed twice if user ends
|
||||
// editing with Enter key.
|
||||
|
||||
- (void)controlTextDidEndEditing:(NSNotification *)aNotif
|
||||
{
|
||||
NSControl *anObject = [aNotif object];
|
||||
|
@ -272,14 +286,14 @@
|
|||
if (rootProject != project)
|
||||
{
|
||||
[inspectorPanel setTitle: [NSString stringWithFormat:
|
||||
@"%@ - Project Inspector", [rootProject projectName]]];
|
||||
@"%@ - Project Inspector", [rootProject projectName]]];
|
||||
}
|
||||
|
||||
project = [projectManager activeProject];
|
||||
projectDict = [project projectDict];
|
||||
|
||||
PCLogStatus(self, @"Active projectChanged to %@",
|
||||
[[project projectDict] objectForKey:PCProjectName]);
|
||||
[[project projectDict] objectForKey:PCProjectName]);
|
||||
|
||||
// 1. Get custom project attributes view
|
||||
newProjAttrSubview = [project projectAttributesView];
|
||||
|
@ -290,7 +304,7 @@
|
|||
else
|
||||
{
|
||||
[projectAttributesView replaceSubview:projectAttributesSubview
|
||||
with:newProjAttrSubview];
|
||||
with:newProjAttrSubview];
|
||||
}
|
||||
projectAttributesSubview = newProjAttrSubview;
|
||||
|
||||
|
@ -318,13 +332,17 @@
|
|||
[projectDict objectForKey:PCCompilerOptions]];
|
||||
[ldOptField setStringValue:
|
||||
[projectDict objectForKey:PCLinkerOptions]];
|
||||
[installPathField setStringValue:
|
||||
[projectDict objectForKey:PCInstallDir]];
|
||||
[installDomainPopup selectItemWithTitle:
|
||||
[projectDict objectForKey:PCInstallDomain]];
|
||||
|
||||
// Project Attributes
|
||||
[projectTypeField setStringValue:[projectDict objectForKey:PCProjectType]];
|
||||
[projectNameField setStringValue:[projectDict objectForKey:PCProjectName]];
|
||||
[projectLanguagePB selectItemWithTitle:[projectDict objectForKey:PCLanguage]];
|
||||
[projectLanguagePB removeAllItems];
|
||||
[projectLanguagePB addItemsWithTitles:
|
||||
[projectDict objectForKey:PCUserLanguages]];
|
||||
[projectLanguagePB selectItemWithTitle:
|
||||
[projectDict objectForKey:PCLanguage]];
|
||||
|
||||
// Project Description view
|
||||
[descriptionField setStringValue:
|
||||
|
@ -341,6 +359,10 @@
|
|||
authorsItems = [projectDict objectForKey:PCAuthors];
|
||||
[authorsList reloadData];
|
||||
|
||||
//Project Languages
|
||||
languagesItems = [projectDict objectForKey:PCUserLanguages];
|
||||
[languagesList reloadData];
|
||||
|
||||
// File Attributes
|
||||
[fileIconView setDelegate:[project projectBrowser]];
|
||||
[fileIconView updateIcon];
|
||||
|
@ -377,6 +399,9 @@
|
|||
// Table
|
||||
[searchOrderList setCornerView:nil];
|
||||
[searchOrderList setHeaderView:nil];
|
||||
[searchOrderList setTarget:self];
|
||||
[searchOrderList setAction:@selector(searchOrderClick:)];
|
||||
// [searchOrderColumn setEditable:NO];
|
||||
|
||||
// Buttons
|
||||
[self setSearchOrderButtonsState];
|
||||
|
@ -390,23 +415,29 @@
|
|||
{
|
||||
NSString *selectedTitle = [sender titleOfSelectedItem];
|
||||
|
||||
if ([selectedTitle isEqualToString: @"Header Directories Search Order"])
|
||||
if ([selectedTitle isEqualToString:@"Header Directories Search Order"])
|
||||
{
|
||||
ASSIGN(searchItems, searchHeaders);
|
||||
ASSIGN(searchItems, [NSMutableArray arrayWithArray:searchHeaders]);
|
||||
}
|
||||
else if ([selectedTitle isEqualToString: @"Library Directories Search Order"])
|
||||
else if ([selectedTitle isEqualToString:@"Library Directories Search Order"])
|
||||
{
|
||||
ASSIGN(searchItems, searchLibs);
|
||||
ASSIGN(searchItems, [NSMutableArray arrayWithArray:searchLibs]);
|
||||
}
|
||||
else if ([selectedTitle isEqualToString:@"Build Targets"])
|
||||
{
|
||||
ASSIGN(searchItems,[NSMutableArray arrayWithArray:[project buildTargets]]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSIGN(searchItems,nil);
|
||||
DESTROY(searchItems);
|
||||
}
|
||||
|
||||
[searchOrderList reloadData];
|
||||
[searchOrderList deselectAll:self];
|
||||
[searchOrderTF setStringValue:@""];
|
||||
|
||||
// Enable/disable buttons according to selected/not selected item
|
||||
[self setSearchOrderButtonsState];
|
||||
|
||||
[searchOrderList reloadData];
|
||||
}
|
||||
|
||||
- (void)searchOrderDoubleClick:(id)sender
|
||||
|
@ -415,17 +446,27 @@
|
|||
|
||||
- (void)searchOrderClick:(id)sender
|
||||
{
|
||||
// Warning! NSTableView doesn't call action method
|
||||
// TODO: Fix NSTableView (NSCell/NSActionCell?)
|
||||
int row = [searchOrderList selectedRow];
|
||||
[searchOrderTF setStringValue:[searchItems objectAtIndex:row]];
|
||||
[searchOrderTF selectText:self];
|
||||
[self setSearchOrderButtonsState];
|
||||
}
|
||||
|
||||
- (void)setSearchOrderButtonsState
|
||||
{
|
||||
// Disable until implemented
|
||||
// "Set..." button is always off until functionality will be implemented
|
||||
[searchOrderSet setEnabled:NO];
|
||||
|
||||
return; // See searchOrderClick
|
||||
// After loadable inspectors implementation make it work by
|
||||
// detection of text field becoming first responder.
|
||||
/* if ([inspectorPanel firstResponder] == searchOrderTF)
|
||||
{
|
||||
[searchOrderAdd setEnabled:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
[searchOrderAdd setEnabled:NO];
|
||||
}*/
|
||||
|
||||
if ([searchOrderList selectedRow] == -1)
|
||||
{
|
||||
|
@ -458,6 +499,11 @@
|
|||
{
|
||||
NSString *value = [searchOrderTF stringValue];
|
||||
|
||||
if ([value isEqualToString:@""])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[searchItems addObject:value];
|
||||
[searchOrderTF setStringValue:@""];
|
||||
[self syncSearchOrder];
|
||||
|
@ -472,17 +518,20 @@
|
|||
pIndex = [searchOrderPopup indexOfSelectedItem];
|
||||
switch (pIndex)
|
||||
{
|
||||
case 0:
|
||||
case 0: // Headers
|
||||
[project setProjectDictObject:searchItems
|
||||
forKey:PCSearchHeaders
|
||||
notify:YES];
|
||||
notify:YES];
|
||||
break;
|
||||
case 1:
|
||||
case 1: // Libraries
|
||||
[project setProjectDictObject:searchItems
|
||||
forKey:PCSearchLibs
|
||||
notify:YES];
|
||||
notify:YES];
|
||||
break;
|
||||
case 2:
|
||||
case 2: // Targets
|
||||
[project setProjectDictObject:searchItems
|
||||
forKey:PCBuilderTargets
|
||||
notify:YES];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -506,7 +555,8 @@
|
|||
|
||||
// Languages
|
||||
[projectLanguagePB removeAllItems];
|
||||
[projectLanguagePB addItemsWithTitles:[NSUserDefaults userLanguages]];
|
||||
[projectLanguagePB addItemsWithTitles:
|
||||
[projectDict objectForKey:PCUserLanguages]];
|
||||
|
||||
// Retain view
|
||||
[projectAttributesView retain];
|
||||
|
@ -517,7 +567,7 @@
|
|||
NSLog(@"set current language to %@", [sender titleOfSelectedItem]);
|
||||
[project setProjectDictObject:[sender titleOfSelectedItem]
|
||||
forKey:PCLanguage
|
||||
notify:NO];
|
||||
notify:NO];
|
||||
[[project projectWindow] setTitle];
|
||||
}
|
||||
|
||||
|
@ -555,6 +605,7 @@
|
|||
[authorsList setHeaderView:nil];
|
||||
[authorsList addTableColumn:authorsColumn];
|
||||
[authorsList setDataSource:self];
|
||||
[authorsList setDelegate:self];
|
||||
|
||||
//
|
||||
[authorsScroll setDocumentView:authorsList];
|
||||
|
@ -602,15 +653,16 @@
|
|||
int selectedRow = [authorsList selectedRow];
|
||||
|
||||
if (selectedRow >= 0)
|
||||
{
|
||||
[authorsItems removeObjectAtIndex:selectedRow];
|
||||
[authorsList reloadData];
|
||||
}
|
||||
{
|
||||
[authorsList selectRow:selectedRow byExtendingSelection:NO];
|
||||
[authorsItems removeObjectAtIndex:selectedRow];
|
||||
[authorsList reloadData];
|
||||
}
|
||||
|
||||
if ([authorsList selectedRow] < 0 && [authorsItems count] > 0)
|
||||
{
|
||||
[authorsList selectRow:[authorsItems count]-1 byExtendingSelection:NO];
|
||||
}
|
||||
{
|
||||
[authorsList selectRow:[authorsItems count]-1 byExtendingSelection:NO];
|
||||
}
|
||||
|
||||
[project setProjectDictObject:authorsItems forKey:PCAuthors notify:YES];
|
||||
}
|
||||
|
@ -657,6 +709,114 @@
|
|||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ==== Project Languages
|
||||
// ============================================================================
|
||||
|
||||
- (void)createProjectLanguages
|
||||
{
|
||||
if (projectLanguagesView)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ([NSBundle loadNibNamed:@"ProjectLanguages" owner:self] == NO)
|
||||
{
|
||||
PCLogError(self, @"error loading ProjectLanguages NIB file!");
|
||||
return;
|
||||
}
|
||||
|
||||
[projectLanguagesView retain];
|
||||
[languagesList setDataSource:self];
|
||||
}
|
||||
|
||||
- (void)addLanguage:(id)sender
|
||||
{
|
||||
NSString *language = [newLanguage stringValue];
|
||||
[newLanguage setStringValue: @""];
|
||||
|
||||
//If there is a language and is new, add this
|
||||
if (([language length] > 0) && (![languagesItems containsObject: language]))
|
||||
{
|
||||
//Add the language to the projectDict
|
||||
[languagesItems addObject: language];
|
||||
[project setProjectDictObject:languagesItems
|
||||
forKey:PCUserLanguages
|
||||
notify:YES];
|
||||
|
||||
/* If there are localizable resources, copy these into the new language
|
||||
directory */
|
||||
if ([[projectDict objectForKey:PCLocalizedResources] count] > 0)
|
||||
{
|
||||
NSString *file, *englishPath, *languagePath;
|
||||
NSEnumerator *resources =
|
||||
[[projectDict objectForKey:PCLocalizedResources] objectEnumerator];
|
||||
|
||||
englishPath = [project resourceDirForLanguage:@"English"];
|
||||
languagePath = [project resourceDirForLanguage:language];
|
||||
|
||||
while ((file = [resources nextObject]))
|
||||
{
|
||||
if ([[projectManager fileManager] copyFile:file
|
||||
fromDirectory:englishPath
|
||||
intoDirectory:languagePath])
|
||||
{
|
||||
NSLog(@"file copied: %@", file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeLanguage:(id)sender
|
||||
{
|
||||
/* We don't remove the English language sice is needed if the app
|
||||
isn't available at the end user language */
|
||||
if (![[languagesItems objectAtIndex:
|
||||
[languagesList selectedRow]] isEqualToString:@"English"])
|
||||
{
|
||||
NSString *language =
|
||||
[languagesItems objectAtIndex:[languagesList selectedRow]];
|
||||
NSString *languagePath = [project resourceDirForLanguage:language];
|
||||
NSArray *resources = [projectDict objectForKey:PCLocalizedResources];
|
||||
|
||||
/* If there are localizable resources, remove these at the language
|
||||
directory and the directory itsel */
|
||||
if ([resources count] > 0)
|
||||
{
|
||||
if ([[projectManager fileManager] removeFiles:resources
|
||||
fromDirectory:languagePath
|
||||
removeDirsIfEmpty:YES])
|
||||
{
|
||||
NSLog(@"removed resources for language %@",language);
|
||||
}
|
||||
}
|
||||
|
||||
//Update the languages list
|
||||
[languagesItems removeObject:language];
|
||||
|
||||
//If the removed language is the actual PCLanguage, set English
|
||||
if ([[projectDict objectForKey: PCLanguage] isEqualToString:language])
|
||||
{
|
||||
NSLog(@"set current language to English");
|
||||
[project setProjectDictObject:@"English"
|
||||
forKey:PCLanguage
|
||||
notify:NO];
|
||||
}
|
||||
|
||||
//Update the projectDict
|
||||
[project setProjectDictObject:languagesItems
|
||||
forKey:PCUserLanguages
|
||||
notify:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSRunAlertPanel(@"Remove Language",
|
||||
@"You shouldn't remove language English",
|
||||
@"Ok",nil,nil);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ==== File Attributes
|
||||
// ============================================================================
|
||||
|
@ -729,18 +889,18 @@
|
|||
|
||||
enumerator = [files objectEnumerator];
|
||||
while ((file = [enumerator nextObject]))
|
||||
{
|
||||
if (![[file pathExtension] isEqualToString:@"h"] &&
|
||||
![[file pathExtension] isEqualToString:@"H"])
|
||||
{
|
||||
enable = NO;
|
||||
}
|
||||
}
|
||||
{
|
||||
if (![[file pathExtension] isEqualToString:@"h"] &&
|
||||
![[file pathExtension] isEqualToString:@"H"])
|
||||
{
|
||||
enable = NO;
|
||||
}
|
||||
}
|
||||
|
||||
if (enable)
|
||||
{
|
||||
[publicHeaderButton setEnabled:YES];
|
||||
}
|
||||
{
|
||||
[publicHeaderButton setEnabled:YES];
|
||||
}
|
||||
}
|
||||
|
||||
// --- Set state of buttons
|
||||
|
@ -756,16 +916,16 @@
|
|||
enumerator = [files objectEnumerator];
|
||||
present_count = 0;
|
||||
while ((file = [enumerator nextObject]))
|
||||
{
|
||||
if ([publicHeaders containsObject:file])
|
||||
{
|
||||
present_count++;
|
||||
}
|
||||
}
|
||||
{
|
||||
if ([publicHeaders containsObject:file])
|
||||
{
|
||||
present_count++;
|
||||
}
|
||||
}
|
||||
if (array_count == present_count)
|
||||
{
|
||||
[publicHeaderButton setState:NSOnState];
|
||||
}
|
||||
{
|
||||
[publicHeaderButton setState:NSOnState];
|
||||
}
|
||||
}
|
||||
|
||||
// Set state of Localized Resource button
|
||||
|
@ -775,16 +935,16 @@
|
|||
enumerator = [files objectEnumerator];
|
||||
present_count = 0;
|
||||
while ((file = [enumerator nextObject]))
|
||||
{
|
||||
if ([localizedResources containsObject:file])
|
||||
{
|
||||
present_count++;
|
||||
}
|
||||
}
|
||||
{
|
||||
if ([localizedResources containsObject:file])
|
||||
{
|
||||
present_count++;
|
||||
}
|
||||
}
|
||||
if (array_count == present_count)
|
||||
{
|
||||
[localizableButton setState:NSOnState];
|
||||
}
|
||||
{
|
||||
[localizableButton setState:NSOnState];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -817,13 +977,23 @@
|
|||
|
||||
- (void)fileNameDidChange:(id)sender
|
||||
{
|
||||
if ([fileName isEqualToString:[fileNameField stringValue]])
|
||||
NSString *newName;
|
||||
|
||||
newName = [fileNameField stringValue];
|
||||
if ([fileName isEqualToString:newName])
|
||||
{
|
||||
[fileNameField setStringValue:fileName];
|
||||
return;
|
||||
}
|
||||
if ([[newName stringByTrimmingCharactersInSet:
|
||||
[NSCharacterSet whitespaceAndNewlineCharacterSet]] length] == 0)
|
||||
{
|
||||
[fileNameField setStringValue:fileName];
|
||||
return;
|
||||
}
|
||||
|
||||
/* PCLogInfo(self, @"{%@} file name changed from: %@ to: %@",
|
||||
[project projectName], fileName, [fileNameField stringValue]);*/
|
||||
[project projectName], fileName, [fileNameField stringValue]);*/
|
||||
|
||||
if ([project renameFile:fileName toFile:[fileNameField stringValue]] == NO)
|
||||
{
|
||||
|
@ -841,13 +1011,13 @@
|
|||
while ((file = [enumerator nextObject]))
|
||||
{
|
||||
if ([sender state] == NSOffState)
|
||||
{
|
||||
[project setHeaderFile:fileName public:NO];
|
||||
}
|
||||
{
|
||||
[project setHeaderFile:fileName public:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
[project setHeaderFile:fileName public:YES];
|
||||
}
|
||||
{
|
||||
[project setHeaderFile:fileName public:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -861,13 +1031,13 @@
|
|||
while ((file = [enumerator nextObject]))
|
||||
{
|
||||
if ([sender state] == NSOffState)
|
||||
{
|
||||
[project setResourceFile:file localizable:NO];
|
||||
}
|
||||
{
|
||||
[project setResourceFile:file localizable:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
[project setResourceFile:file localizable:YES];
|
||||
}
|
||||
{
|
||||
[project setResourceFile:file localizable:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -884,7 +1054,7 @@
|
|||
// ==== NSTableViews
|
||||
// ============================================================================
|
||||
|
||||
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
|
||||
{
|
||||
if (searchOrderList != nil && aTableView == searchOrderList)
|
||||
{
|
||||
|
@ -894,13 +1064,17 @@
|
|||
{
|
||||
return [authorsItems count];
|
||||
}
|
||||
else if (languagesList != nil && aTableView == languagesList)
|
||||
{
|
||||
return [languagesItems count];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (id) tableView:(NSTableView *)aTableView
|
||||
objectValueForTableColumn:(NSTableColumn *)aTableColumn
|
||||
row:(int)rowIndex
|
||||
row:(NSInteger)rowIndex
|
||||
{
|
||||
if (searchOrderList != nil && aTableView == searchOrderList)
|
||||
{
|
||||
|
@ -910,6 +1084,10 @@
|
|||
{
|
||||
return [authorsItems objectAtIndex:rowIndex];
|
||||
}
|
||||
else if (languagesList != nil && aTableView == languagesList)
|
||||
{
|
||||
return [languagesItems objectAtIndex:rowIndex];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
@ -917,14 +1095,14 @@
|
|||
- (void) tableView:(NSTableView *)aTableView
|
||||
setObjectValue:anObject
|
||||
forTableColumn:(NSTableColumn *)aTableColumn
|
||||
row:(int)rowIndex
|
||||
row:(NSInteger)rowIndex
|
||||
{
|
||||
if (authorsList != nil && aTableView == authorsList)
|
||||
{
|
||||
if([authorsItems count] <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if([authorsItems count] == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[authorsItems removeObjectAtIndex:rowIndex];
|
||||
[authorsItems insertObject:anObject atIndex:rowIndex];
|
||||
|
@ -933,4 +1111,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) tableView: (NSTableView*)aTableView
|
||||
willDisplayCell: (id)aCell
|
||||
forTableColumn: (NSTableColumn*)aTableColumn
|
||||
row: (NSInteger)rowIndex
|
||||
{
|
||||
[(NSTextFieldCell *)aCell setScrollable:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2000-2004 Free Software Foundation
|
||||
Copyright (C) 2000-2020 Free Software Foundation
|
||||
|
||||
Authors: Philippe C.D. Robert
|
||||
Serg Stoyan
|
||||
Riccardo Mottola
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
|
@ -20,26 +21,31 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#include <ProjectCenter/PCProjectManager.h>
|
||||
#include <ProjectCenter/PCProjectLauncher.h>
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCProjectLauncher.h>
|
||||
#import <ProjectCenter/PCBundleManager.h>
|
||||
#import <ProjectCenter/PCButton.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
#import <Protocols/Preferences.h>
|
||||
|
||||
#include <ProjectCenter/PCButton.h>
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import "Modules/Preferences/Misc/PCMiscPrefs.h"
|
||||
#import "Modules/Preferences/EditorFSC/PCEditorFSCPrefs.h"
|
||||
|
||||
|
||||
#ifndef NOTIFICATION_CENTER
|
||||
#define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter]
|
||||
#endif
|
||||
|
||||
#ifndef IMAGE
|
||||
#define IMAGE(X) [[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:(X)]] autorelease]
|
||||
#define IMAGE(X) [NSImage imageNamed: X]
|
||||
#endif
|
||||
|
||||
enum {
|
||||
|
@ -120,7 +126,7 @@ enum {
|
|||
NSMakeSize([stdOut frame].size.width, 1e7)];
|
||||
|
||||
// Font
|
||||
string = [NSString stringWithString:@"=== Launcher ready ==="];
|
||||
string = @"=== Launcher ready ===";
|
||||
attributedString =
|
||||
[[NSAttributedString alloc] initWithString:string
|
||||
attributes:textAttributes];
|
||||
|
@ -143,10 +149,20 @@ enum {
|
|||
|
||||
if ((self = [super init]))
|
||||
{
|
||||
NSFont *font = [NSFont userFixedPitchFontOfSize: 10.0];
|
||||
id <PCPreferences> prefs;
|
||||
NSFont *font;
|
||||
NSString *fontName;
|
||||
CGFloat fontSize;
|
||||
|
||||
project = aProject;
|
||||
|
||||
prefs = [[project projectManager] prefController];
|
||||
fontName = [prefs stringForKey:ConsoleFixedFont];
|
||||
fontSize = [prefs floatForKey:ConsoleFixedFontSize];
|
||||
font = [NSFont fontWithName:fontName size:fontSize];
|
||||
if (font == nil)
|
||||
font = [NSFont userFixedPitchFontOfSize:0];
|
||||
|
||||
textAttributes =
|
||||
[NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
|
||||
[textAttributes retain];
|
||||
|
@ -162,6 +178,7 @@ enum {
|
|||
#endif
|
||||
RELEASE (componentView);
|
||||
RELEASE (textAttributes);
|
||||
RELEASE (debugger);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -204,16 +221,33 @@ enum {
|
|||
|
||||
- (void)debug:(id)sender
|
||||
{
|
||||
NSString *projectName = [project projectName];
|
||||
NSString *fp = nil;
|
||||
NSString *pn = nil;
|
||||
NSString *gdbPath = nil;
|
||||
NSArray *args = nil;
|
||||
NSDistantObject <Terminal> *terminal;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSString *executablePath;
|
||||
NSString *gdbPath = nil;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
PCBundleManager *bundleManager = [[project projectManager] bundleManager];
|
||||
|
||||
// Check if project type is executable
|
||||
if (![project isExecutable])
|
||||
executablePath = [project projectPath];
|
||||
|
||||
if ([project isExecutable])
|
||||
{
|
||||
NSString *prjType;
|
||||
|
||||
prjType = [project projectTypeName];
|
||||
if ([prjType isEqualToString: @"Application"])
|
||||
{
|
||||
/* MyApplication.app/MyApplication */
|
||||
executablePath = [executablePath stringByAppendingPathComponent:[project projectName]];
|
||||
executablePath = [executablePath stringByAppendingString:@".app"];
|
||||
executablePath = [executablePath stringByAppendingPathComponent:[project projectName]];
|
||||
}
|
||||
else if ([prjType isEqualToString: @"Tool"])
|
||||
{
|
||||
/* obj/MyTool */
|
||||
executablePath = [executablePath stringByAppendingPathComponent:@"obj"];
|
||||
executablePath = [executablePath stringByAppendingPathComponent:[project projectName]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSRunAlertPanel(@"Debug",
|
||||
@"The project is not executable",
|
||||
|
@ -222,107 +256,95 @@ enum {
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: Is it possible to somehow support users that don't have
|
||||
* Terminal installed ? Maybe with reduced functionality.
|
||||
*/
|
||||
#ifdef __MINGW__
|
||||
/* On windows we need to check the .exe file */
|
||||
if ([[executablePath pathExtension] length] == 0)
|
||||
{
|
||||
executablePath = [executablePath stringByAppendingPathExtension: @"exe"];
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the Terminal application
|
||||
terminal = (NSDistantObject<Terminal> *)[NSConnection
|
||||
rootProxyForConnectionWithRegisteredName:@"Terminal" host:nil];
|
||||
|
||||
if (terminal == nil)
|
||||
NSLog(@"debug executable launch path: %@", executablePath);
|
||||
if ([fm isExecutableFileAtPath:executablePath] == NO)
|
||||
{
|
||||
NSRunAlertPanel(@"Debug",
|
||||
@"Run Terminal application first",
|
||||
@"No executable! Please build the project first.",
|
||||
@"Close",nil,nil);
|
||||
[debugButton setState:NSOffState];
|
||||
return;
|
||||
}
|
||||
|
||||
/* We try in the order:
|
||||
* xxx.debug/xxx (gnustep-make v1, application),
|
||||
* xxx.app/xxx (gnustep-make v1 and v2, application),
|
||||
* obj/xxx (gnustep-make v1 and v2, tool).
|
||||
*/
|
||||
fp = [project projectPath];
|
||||
fp = [fp stringByAppendingPathComponent: [projectName stringByAppendingPathExtension: @"debug"]];
|
||||
fp = [fp stringByAppendingPathComponent: projectName];
|
||||
|
||||
if (! [fm isExecutableFileAtPath: fp])
|
||||
{
|
||||
fp = [project projectPath];
|
||||
fp = [fp stringByAppendingPathComponent: [projectName stringByAppendingPathExtension: @"app"]];
|
||||
fp = [fp stringByAppendingPathComponent: projectName];
|
||||
|
||||
if (! [fm isExecutableFileAtPath: fp])
|
||||
{
|
||||
fp = [project projectPath];
|
||||
fp = [fp stringByAppendingPathComponent: @"obj"];
|
||||
fp = [fp stringByAppendingPathComponent: projectName];
|
||||
}
|
||||
}
|
||||
|
||||
// PCLogInfo(self, @"debug: %@", fp);
|
||||
|
||||
if ([fm isExecutableFileAtPath:fp] == NO)
|
||||
{
|
||||
NSRunAlertPanel(@"Debug",
|
||||
@"Can't execute %@!",
|
||||
@"Abort",nil,nil,pn);
|
||||
[debugButton setState:NSOffState];
|
||||
return;
|
||||
}
|
||||
|
||||
// Debugger
|
||||
gdbPath = [[NSUserDefaults standardUserDefaults] objectForKey:Debugger];
|
||||
gdbPath = [[[project projectManager] prefController] stringForKey:Debugger];
|
||||
if (gdbPath == nil)
|
||||
{
|
||||
gdbPath = [NSString stringWithString:@"/usr/bin/gdb"];
|
||||
gdbPath = @"/usr/bin/gdb";
|
||||
}
|
||||
|
||||
if ([fm isExecutableFileAtPath:gdbPath] == NO)
|
||||
{
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Invalid debugger specified: %@!",
|
||||
@"Abort",nil,nil,gdbPath);
|
||||
NSRunAlertPanel(@"Debug",
|
||||
@"Specified debugger `%@` cannot be executed!",
|
||||
@"Close",nil,nil,gdbPath);
|
||||
[debugButton setState:NSOffState];
|
||||
return;
|
||||
}
|
||||
|
||||
// Task
|
||||
args = [[NSArray alloc] initWithObjects:gdbPath, @"--args", fp, nil];
|
||||
|
||||
[terminal terminalRunProgram:AUTORELEASE(gdbPath)
|
||||
withArguments:args
|
||||
inDirectory:nil
|
||||
properties:nil];
|
||||
// Debugger
|
||||
if (nil == debugger)
|
||||
{
|
||||
debugger = [bundleManager objectForBundleType: @"debugger"
|
||||
protocol: @protocol(CodeDebugger)
|
||||
fileName: [executablePath stringByDeletingLastPathComponent]];
|
||||
[debugger debugExecutableAtPath: executablePath
|
||||
withDebugger: gdbPath];
|
||||
}
|
||||
else
|
||||
{
|
||||
[debugger show];
|
||||
}
|
||||
|
||||
[debugButton setState:NSOffState];
|
||||
if (nil == debugger)
|
||||
NSLog(@"No debugger module found");
|
||||
|
||||
AUTORELEASE(args);
|
||||
// turn debug button off...
|
||||
// [debugButton setState:NSOffState];
|
||||
}
|
||||
|
||||
- (void)run:(id)sender
|
||||
{
|
||||
NSMutableArray *args = [[NSMutableArray alloc] init];
|
||||
NSPipe *logPipe;
|
||||
NSPipe *errorPipe;
|
||||
NSString *openPath;
|
||||
NSMutableArray *args = [[NSMutableArray alloc] init];
|
||||
NSPipe *logPipe;
|
||||
NSPipe *errorPipe;
|
||||
NSString *executablePath;
|
||||
NSFileManager *fm;
|
||||
|
||||
executablePath = [project projectPath];
|
||||
|
||||
// Check if project type is executable
|
||||
if ([project isExecutable])
|
||||
{
|
||||
openPath = [project execToolName];
|
||||
if ([openPath isEqualToString: @"openapp"])
|
||||
NSString *prjType;
|
||||
|
||||
prjType = [project projectTypeName];
|
||||
if ([prjType isEqualToString: @"Application"])
|
||||
{
|
||||
/* openapp ./MyApplication.app */
|
||||
[args addObject: [NSString stringWithFormat: @"./%@", [project projectName]]];
|
||||
/* MyApplication.app/MyApplication */
|
||||
executablePath = [executablePath stringByAppendingPathComponent:[project projectName]];
|
||||
executablePath = [executablePath stringByAppendingString:@".app"];
|
||||
executablePath = [executablePath stringByAppendingPathComponent:[project projectName]];
|
||||
}
|
||||
else if ([prjType isEqualToString: @"Tool"])
|
||||
{
|
||||
/* obj/MyTool */
|
||||
executablePath = [executablePath stringByAppendingPathComponent:@"obj"];
|
||||
executablePath = [executablePath stringByAppendingPathComponent:[project projectName]];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* opentool MyTool */
|
||||
[args addObject: [project projectName]];
|
||||
NSLog(@"Unknown project type to execute: %@", prjType);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -334,6 +356,28 @@ enum {
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef __MINGW__
|
||||
/* On windows we need to check the .exe file */
|
||||
if ([[executablePath pathExtension] length] == 0)
|
||||
{
|
||||
executablePath = [executablePath stringByAppendingPathExtension: @"exe"];
|
||||
}
|
||||
#endif
|
||||
|
||||
NSLog(@"executable launch path: %@", executablePath);
|
||||
|
||||
/* now check if the executable does exist. Perhaps make failed */
|
||||
fm = [NSFileManager defaultManager];
|
||||
if (![fm isExecutableFileAtPath:executablePath])
|
||||
{
|
||||
NSRunAlertPanel(@"Run",
|
||||
@"The project does not have an executable",
|
||||
@"Close", nil, nil, nil);
|
||||
[runButton setState:NSOffState];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// [makeTask isRunning] doesn't work here.
|
||||
// "waitpid 7045, result -1, error No child processes" is printed.
|
||||
if (launchTask)
|
||||
|
@ -376,7 +420,7 @@ enum {
|
|||
object:launchTask];
|
||||
[launchTask setArguments:args];
|
||||
[launchTask setCurrentDirectoryPath:[project projectPath]];
|
||||
[launchTask setLaunchPath:openPath];
|
||||
[launchTask setLaunchPath:executablePath];
|
||||
[launchTask setStandardOutput:logPipe];
|
||||
[launchTask setStandardError:errorPipe];
|
||||
[launchTask launch];
|
||||
|
@ -384,6 +428,7 @@ enum {
|
|||
[debugButton setEnabled:NO];
|
||||
|
||||
_isRunning = YES;
|
||||
_isErrorRunning = YES;
|
||||
RELEASE(args);
|
||||
}
|
||||
|
||||
|
@ -394,7 +439,16 @@ enum {
|
|||
return;
|
||||
}
|
||||
|
||||
[NOTIFICATION_CENTER removeObserver:self];
|
||||
[NOTIFICATION_CENTER removeObserver: self
|
||||
name: NSTaskDidTerminateNotification
|
||||
object: launchTask];
|
||||
|
||||
// Wait if there are data available.
|
||||
if (_isRunning || _isErrorRunning)
|
||||
{
|
||||
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode
|
||||
beforeDate: [NSDate distantFuture]];
|
||||
}
|
||||
|
||||
[runButton setState:NSOffState];
|
||||
[debugButton setState:NSOffState];
|
||||
|
@ -404,7 +458,6 @@ enum {
|
|||
|
||||
RELEASE(launchTask);
|
||||
launchTask = nil;
|
||||
_isRunning = NO;
|
||||
_isDebugging = NO;
|
||||
|
||||
}
|
||||
|
@ -413,24 +466,38 @@ enum {
|
|||
{
|
||||
NSData *data;
|
||||
|
||||
if ((data = [readHandle availableData]))
|
||||
if ((data = [readHandle availableData]) && [data length] > 0)
|
||||
{
|
||||
[self logData:data error:NO];
|
||||
[readHandle waitForDataInBackgroundAndNotifyForModes:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
[NOTIFICATION_CENTER removeObserver: self
|
||||
name: NSFileHandleDataAvailableNotification
|
||||
object: readHandle];
|
||||
|
||||
[readHandle waitForDataInBackgroundAndNotifyForModes:nil];
|
||||
_isRunning = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)logErrOut:(NSNotification *)aNotif
|
||||
{
|
||||
NSData *data;
|
||||
|
||||
if ((data = [errorReadHandle availableData]))
|
||||
if ((data = [errorReadHandle availableData]) && [data length] > 0)
|
||||
{
|
||||
[self logData:data error:YES];
|
||||
[errorReadHandle waitForDataInBackgroundAndNotifyForModes:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
[NOTIFICATION_CENTER removeObserver: self
|
||||
name: NSFileHandleDataAvailableNotification
|
||||
object: errorReadHandle];
|
||||
|
||||
[errorReadHandle waitForDataInBackgroundAndNotifyForModes:nil];
|
||||
_isErrorRunning = NO;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -19,28 +19,26 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCProjectManager.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#include <ProjectCenter/PCProjectLauncher.h>
|
||||
#include <ProjectCenter/PCProjectLauncherPanel.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCProjectLauncher.h>
|
||||
#import <ProjectCenter/PCProjectLauncherPanel.h>
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
#import "Modules/Preferences/Misc/PCMiscPrefs.h"
|
||||
|
||||
@implementation PCProjectLauncherPanel
|
||||
|
||||
- (id)initWithProjectManager:(PCProjectManager *)aManager
|
||||
{
|
||||
PCProjectLauncher *projectLauncher = nil;
|
||||
PCProject *activeProject = nil;
|
||||
|
||||
projectManager = aManager;
|
||||
activeProject = [projectManager rootActiveProject];
|
||||
projectLauncher = [activeProject projectLauncher];
|
||||
|
||||
projectLauncher = [[aManager activeProject] projectLauncher];
|
||||
|
||||
self = [super initWithContentRect: NSMakeRect (0, 300, 480, 322)
|
||||
styleMask: (NSTitledWindowMask
|
||||
|
@ -123,8 +121,15 @@
|
|||
|
||||
- (void)activeProjectDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
PCProject *rootProject = [projectManager rootActiveProject];
|
||||
PCProject *rootProject;
|
||||
id <PCPreferences> prefs = [projectManager prefController];
|
||||
|
||||
if (![prefs boolForKey:UseTearOffWindows])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
rootProject = [projectManager rootActiveProject];
|
||||
if (rootProject == currentProject)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -20,25 +20,31 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCProjectEditor.h>
|
||||
|
||||
#import <ProjectCenter/PCPrefController.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
#import <Protocols/CodeEditor.h>
|
||||
#import <ProjectCenter/PCProjectLoadedFiles.h>
|
||||
|
||||
#import "Modules/Preferences/Misc/PCMiscPrefs.h"
|
||||
|
||||
@implementation PCProjectLoadedFiles
|
||||
|
||||
- (id)initWithProject:(PCProject *)aProj
|
||||
{
|
||||
id <PCPreferences> prefs;
|
||||
|
||||
NSAssert(aProj, @"Project is mandatory!");
|
||||
|
||||
prefs = [[aProj projectManager] prefController];
|
||||
|
||||
PCLogStatus(self, @"init");
|
||||
|
||||
if ((self = [super init]))
|
||||
|
@ -74,8 +80,7 @@
|
|||
[filesScroll setDocumentView:filesList];
|
||||
[filesScroll setHasHorizontalScroller:NO];
|
||||
[filesScroll setHasVerticalScroller:YES];
|
||||
if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
|
||||
objectForKey:SeparateLoadedFiles] isEqualToString:@"NO"])
|
||||
if (![prefs boolForKey:UseTearOffWindows])
|
||||
{
|
||||
[filesScroll setBorderType:NSBezelBorder];
|
||||
}
|
||||
|
@ -336,7 +341,7 @@
|
|||
|
||||
@implementation PCProjectLoadedFiles (LoadedFilesTableDelegate)
|
||||
|
||||
- (int)numberOfRowsInTableView: (NSTableView *)aTableView
|
||||
- (NSInteger)numberOfRowsInTableView: (NSTableView *)aTableView
|
||||
{
|
||||
if (aTableView != filesList)
|
||||
{
|
||||
|
@ -348,7 +353,7 @@
|
|||
|
||||
- (id) tableView: (NSTableView *)aTableView
|
||||
objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
||||
row: (int)rowIndex
|
||||
row: (NSInteger)rowIndex
|
||||
{
|
||||
if (aTableView != filesList)
|
||||
{
|
||||
|
@ -371,7 +376,7 @@
|
|||
- (void) tableView:(NSTableView *)aTableView
|
||||
setObjectValue:anObject
|
||||
forTableColumn:(NSTableColumn *)aTableColumn
|
||||
row:(int)rowIndex
|
||||
row:(NSInteger)rowIndex
|
||||
{
|
||||
/* NSString *path = nil;
|
||||
NSParameterAssert (rowIndex >= 0 && rowIndex < [editedFiles count]);
|
||||
|
|
|
@ -19,27 +19,27 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCProjectManager.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
#include <ProjectCenter/PCProjectLoadedFiles.h>
|
||||
#include <ProjectCenter/PCProjectLoadedFilesPanel.h>
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
#import <ProjectCenter/PCProject.h>
|
||||
#import <ProjectCenter/PCProjectLoadedFiles.h>
|
||||
#import <ProjectCenter/PCProjectLoadedFilesPanel.h>
|
||||
|
||||
#include <ProjectCenter/PCLogController.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
#import "Modules/Preferences/Misc/PCMiscPrefs.h"
|
||||
|
||||
@implementation PCProjectLoadedFilesPanel
|
||||
|
||||
- (id)initWithProjectManager:(PCProjectManager *)aManager
|
||||
{
|
||||
PCProjectLoadedFiles *projectLoadedFiles = nil;
|
||||
PCProject *activeProject = nil;
|
||||
|
||||
projectManager = aManager;
|
||||
activeProject = [projectManager rootActiveProject];
|
||||
currentProject = activeProject;
|
||||
projectLoadedFiles = [activeProject projectLoadedFiles];
|
||||
|
||||
PCLogStatus(self, @"[init]");
|
||||
|
||||
|
@ -123,8 +123,15 @@
|
|||
|
||||
- (void)activeProjectDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
PCProject *rootProject = [projectManager rootActiveProject];
|
||||
PCProject *rootProject;
|
||||
id <PCPreferences> prefs = [projectManager prefController];
|
||||
|
||||
if (![prefs boolForKey:UseTearOffWindows])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
rootProject = [projectManager rootActiveProject];
|
||||
if (rootProject == currentProject)
|
||||
{
|
||||
return;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2000-2004 Free Software Foundation
|
||||
Copyright (C) 2000-2023 Free Software Foundation
|
||||
|
||||
Authors: Philippe C.D. Robert
|
||||
Serg Stoyan
|
||||
Riccardo Mottola
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
|
@ -20,11 +21,10 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#import <ProjectCenter/PCDefines.h>
|
||||
#import <ProjectCenter/PCSplitView.h>
|
||||
#import <ProjectCenter/PCButton.h>
|
||||
|
||||
#import <ProjectCenter/PCProjectManager.h>
|
||||
|
@ -38,9 +38,15 @@
|
|||
#import <ProjectCenter/PCProjectLoadedFiles.h>
|
||||
#import <ProjectCenter/PCProjectInspector.h>
|
||||
|
||||
#import <ProjectCenter/PCPrefController.h>
|
||||
#import <Protocols/Preferences.h>
|
||||
#import <Protocols/CodeEditorView.h>
|
||||
#import <ProjectCenter/PCLogController.h>
|
||||
|
||||
#import "Modules/Preferences/Misc/PCMiscPrefs.h"
|
||||
|
||||
|
||||
#import <math.h>
|
||||
|
||||
@implementation PCProjectWindow
|
||||
|
||||
// ============================================================================
|
||||
|
@ -65,6 +71,7 @@
|
|||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
id <PCPreferences> prefs = [[project projectManager] prefController];
|
||||
NSRect rect;
|
||||
|
||||
[buildButton setToolTip:@"Project Builder"];
|
||||
|
@ -79,7 +86,7 @@
|
|||
|
||||
[loadedFilesButton setToolTip:@"Loaded Files"];
|
||||
[loadedFilesButton setImage:IMAGE(@"Files")];
|
||||
if ([self hasLoadedFilesView])
|
||||
if (![prefs boolForKey:UseTearOffWindows])
|
||||
{
|
||||
[loadedFilesButton setEnabled:NO];
|
||||
}
|
||||
|
@ -97,7 +104,7 @@
|
|||
[statusLine setStringValue:@""];
|
||||
|
||||
/*
|
||||
* Hosrizontal split view
|
||||
* Horizontal split view
|
||||
*/
|
||||
rect = [[projectWindow contentView] frame];
|
||||
rect.size.height -= 62;
|
||||
|
@ -114,7 +121,7 @@
|
|||
{
|
||||
rect.size.height = 185;
|
||||
}
|
||||
v_split = [[PCSplitView alloc] initWithFrame:rect];
|
||||
v_split = [[NSSplitView alloc] initWithFrame:rect];
|
||||
[v_split setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
|
||||
[v_split setVertical:YES];
|
||||
[v_split setDelegate:self];
|
||||
|
@ -128,7 +135,7 @@
|
|||
/*
|
||||
* LoadedFiles
|
||||
*/
|
||||
if ([self hasLoadedFilesView])
|
||||
if (![prefs boolForKey:UseTearOffWindows])
|
||||
{
|
||||
[self showProjectLoadedFiles:self];
|
||||
}
|
||||
|
@ -140,10 +147,7 @@
|
|||
* Custom view
|
||||
* View where non-separated Builder, Launcher, Editor goes.
|
||||
*/
|
||||
if ([self hasCustomView])
|
||||
{
|
||||
[self _createCustomView];
|
||||
}
|
||||
[self _createCustomView];
|
||||
}
|
||||
|
||||
- (id)initWithProject:(PCProject *)owner
|
||||
|
@ -170,7 +174,7 @@
|
|||
// Window
|
||||
[projectWindow setFrameAutosaveName:@"ProjectWindow"];
|
||||
|
||||
pcWindows = [[project projectDict] objectForKey:@"PC_WINDOWS"];
|
||||
pcWindows = [[project projectDict] objectForKey:PCWindows];
|
||||
windowFrame = [pcWindows objectForKey:@"ProjectWindow"];
|
||||
// PCLogInfo(self, @"window frame %@", windowFrame);
|
||||
if (windowFrame != nil)
|
||||
|
@ -256,11 +260,10 @@
|
|||
|
||||
- (void)dealloc
|
||||
{
|
||||
#ifdef DEVELOPMENT
|
||||
NSLog (@"PCProjectWindow: dealloc");
|
||||
#endif
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[h_split setDelegate:nil];
|
||||
[v_split setDelegate:nil];
|
||||
[projectWindow close];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -269,45 +272,11 @@
|
|||
// ==== Accessory methods
|
||||
// ============================================================================
|
||||
|
||||
- (BOOL)hasCustomView
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
_hasCustomView = NO;
|
||||
|
||||
if (![[ud objectForKey:SeparateEditor] isEqualToString:@"YES"]
|
||||
&& [[ud objectForKey:Editor] isEqualToString:@"ProjectCenter"])
|
||||
{
|
||||
_hasCustomView = YES;
|
||||
}
|
||||
if (![[ud objectForKey:SeparateBuilder] isEqualToString:@"YES"])
|
||||
{
|
||||
_hasCustomView = YES;
|
||||
}
|
||||
if (![[ud objectForKey:SeparateLauncher] isEqualToString:@"YES"])
|
||||
{
|
||||
_hasCustomView = YES;
|
||||
}
|
||||
|
||||
return _hasCustomView;
|
||||
}
|
||||
|
||||
- (BOOL)hasLoadedFilesView
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (![[ud objectForKey:SeparateLoadedFiles] isEqualToString:@"YES"])
|
||||
{
|
||||
_hasLoadedFilesView = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
_hasLoadedFilesView = NO;
|
||||
}
|
||||
|
||||
return _hasLoadedFilesView;
|
||||
}
|
||||
|
||||
// TODO: Should be removed when two modes will be implemented:
|
||||
// Build, Launch and Loaded Files are tear-off and tear-on.
|
||||
// Custom view is always shown because editor always opened on
|
||||
// one click in Browser. External editor will be opened only on
|
||||
// double click.
|
||||
- (NSView *)customContentView
|
||||
{
|
||||
return [customView contentView];
|
||||
|
@ -335,21 +304,30 @@
|
|||
|
||||
- (void)showProjectBuild:(id)sender
|
||||
{
|
||||
NSView *view = [[project projectBuilder] componentView];
|
||||
NSPanel *buildPanel = [[project projectManager] buildPanel];
|
||||
id <PCPreferences> prefs = [[project projectManager] prefController];
|
||||
NSView *view = [[project projectBuilder] componentView];
|
||||
NSPanel *buildPanel = [[project projectManager] buildPanel];
|
||||
PCProject *rootActiveProject;
|
||||
|
||||
if ([[[PCPrefController sharedPCPreferences] objectForKey:SeparateBuilder]
|
||||
isEqualToString: @"YES"])
|
||||
rootActiveProject = [[project projectManager] rootActiveProject];
|
||||
|
||||
// NSLog(@"ProjectWindow showProjectBuild: componentView RC:%i",
|
||||
// [view retainCount]);
|
||||
|
||||
if ([prefs boolForKey:UseTearOffWindows])
|
||||
{
|
||||
if ([customView contentView] == view)
|
||||
{
|
||||
[self showProjectEditor:self];
|
||||
}
|
||||
[buildPanel orderFront:nil];
|
||||
if (rootActiveProject == project)
|
||||
{
|
||||
[buildPanel orderFront:nil];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([buildPanel isVisible])
|
||||
if ((rootActiveProject == project) && [buildPanel isVisible])
|
||||
{
|
||||
[buildPanel close];
|
||||
}
|
||||
|
@ -359,20 +337,20 @@
|
|||
|
||||
- (void)showProjectLaunch:(id)sender
|
||||
{
|
||||
NSView *view = nil;
|
||||
NSPanel *launchPanel = nil;
|
||||
id <PCPreferences> prefs = [[project projectManager] prefController];
|
||||
NSView *view = nil;
|
||||
NSPanel *launchPanel = nil;
|
||||
|
||||
view = [[project projectLauncher] componentView];
|
||||
launchPanel = [[project projectManager] launchPanel];
|
||||
|
||||
if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
|
||||
objectForKey: SeparateLauncher] isEqualToString: @"YES"])
|
||||
if ([prefs boolForKey:UseTearOffWindows])
|
||||
{
|
||||
if ([customView contentView] == view)
|
||||
{
|
||||
[self showProjectEditor:self];
|
||||
}
|
||||
[launchPanel orderFront: nil];
|
||||
[launchPanel orderFront:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -386,29 +364,37 @@
|
|||
|
||||
- (void)showProjectLoadedFiles:(id)sender
|
||||
{
|
||||
NSPanel *panel = [[project projectManager] loadedFilesPanel];
|
||||
NSScrollView *componentView;
|
||||
id <PCPreferences> prefs = [[project projectManager] prefController];
|
||||
NSPanel *panel = [[project projectManager] loadedFilesPanel];
|
||||
PCProject *rootActiveProject;
|
||||
NSScrollView *componentView;
|
||||
|
||||
rootActiveProject = [[project projectManager] rootActiveProject];
|
||||
componentView = (NSScrollView *)[[project projectLoadedFiles] componentView];
|
||||
|
||||
// PCLogInfo(self, @"showProjectLoadedFiles");
|
||||
|
||||
if ([self hasLoadedFilesView])
|
||||
if ([prefs boolForKey:UseTearOffWindows])
|
||||
{
|
||||
if (panel && [panel isVisible])
|
||||
[componentView setBorderType:NSNoBorder];
|
||||
[componentView removeFromSuperview];
|
||||
if (rootActiveProject == project)
|
||||
{
|
||||
[panel orderFront:nil];
|
||||
}
|
||||
[v_split adjustSubviews];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((rootActiveProject == project) && panel && [panel isVisible])
|
||||
{
|
||||
[panel close];
|
||||
}
|
||||
|
||||
[componentView setBorderType:NSBezelBorder];
|
||||
[componentView setFrame:NSMakeRect(0,0,128,130)];
|
||||
[v_split addSubview:[[project projectLoadedFiles] componentView]];
|
||||
[v_split adjustSubviews];
|
||||
}
|
||||
else
|
||||
{
|
||||
[componentView setBorderType:NSNoBorder];
|
||||
[panel orderFront:nil];
|
||||
// Preserve width of view in panel
|
||||
// [componentView setFrame:NSMakeRect(0,0,128,130)];
|
||||
[v_split addSubview:componentView];
|
||||
[v_split adjustSubviews];
|
||||
}
|
||||
}
|
||||
|
@ -447,6 +433,7 @@
|
|||
// from/to superview
|
||||
RETAIN(h_split);
|
||||
[h_split removeFromSuperview];
|
||||
rect = [cView centerScanRect: rect];
|
||||
[h_split setFrame:rect];
|
||||
[cView addSubview:h_split];
|
||||
RELEASE(h_split);
|
||||
|
@ -460,6 +447,7 @@
|
|||
RETAIN(v_split);
|
||||
[v_split removeFromSuperview];
|
||||
[v_split setFrame:rect];
|
||||
rect = [cView centerScanRect: rect];
|
||||
[cView addSubview:v_split];
|
||||
RELEASE(v_split);
|
||||
}
|
||||
|
@ -484,6 +472,7 @@
|
|||
// Hack. See above
|
||||
RETAIN(h_split);
|
||||
[h_split removeFromSuperview];
|
||||
rect = [cView centerScanRect: rect];
|
||||
[h_split setFrame:rect];
|
||||
[cView addSubview:h_split];
|
||||
RELEASE(h_split);
|
||||
|
@ -555,80 +544,62 @@
|
|||
[self makeKeyWindow];*/
|
||||
}
|
||||
|
||||
// TODO: Review determining of tear-off panels. Current implementation
|
||||
// loads Build, Launch and Loaded Files to check visibility status.
|
||||
// It is incorrect behaviour; Build. Launch and LoadedFiles initialized
|
||||
// even if not in use.
|
||||
- (void)preferencesDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
NSDictionary *prefsDict = [[aNotif object] preferencesDict];
|
||||
id <PCPreferences> prefs = [aNotif object];
|
||||
|
||||
PCLogStatus(self, @"Preferences did change");
|
||||
NSLog(@"ProjectWindow: Preferences did change");
|
||||
|
||||
//--- Add Custom view
|
||||
if ([self hasCustomView] && customView == nil)
|
||||
/* if ([[project projectManager] rootActiveProject] != project)
|
||||
{
|
||||
[self _createCustomView];
|
||||
}
|
||||
//--- Remove Custom view
|
||||
if (![self hasCustomView] && customView != nil)
|
||||
{
|
||||
[customView removeFromSuperview];
|
||||
[h_split adjustSubviews];
|
||||
customView = nil;
|
||||
}
|
||||
return;
|
||||
}*/
|
||||
|
||||
|
||||
// Project Builder
|
||||
if ([[prefsDict objectForKey:@"SeparateBuilder"] isEqualToString:@"YES"])
|
||||
if ([prefs boolForKey:UseTearOffWindows])
|
||||
{
|
||||
// Project Build is sepearate and visible in project window
|
||||
// Project Build
|
||||
if ([[[project projectBuilder] componentView] window] == projectWindow)
|
||||
{
|
||||
[self showProjectBuild:self];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSPanel *buildPanel = [[project projectManager] buildPanel];
|
||||
|
||||
if ([buildPanel isVisible] == YES)
|
||||
{
|
||||
[self showProjectBuild:self];
|
||||
}
|
||||
}
|
||||
|
||||
// Project Launcher
|
||||
if ([[prefsDict objectForKey:@"SeparateLauncher"] isEqualToString:@"YES"])
|
||||
{
|
||||
// Project Launch
|
||||
if ([[[project projectLauncher] componentView] window] == projectWindow)
|
||||
{
|
||||
[self showProjectLaunch:self];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSPanel *launchPanel = [[project projectManager] launchPanel];
|
||||
|
||||
if ([launchPanel isVisible] == YES)
|
||||
{
|
||||
[self showProjectLaunch:self];
|
||||
}
|
||||
}
|
||||
|
||||
// Loaded Files view
|
||||
if ([self hasLoadedFilesView])
|
||||
{
|
||||
if ([[v_split subviews] count] == 1)
|
||||
{
|
||||
[self showProjectLoadedFiles:self];
|
||||
}
|
||||
[loadedFilesButton setEnabled:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Loaded Files
|
||||
if ([[v_split subviews] count] == 2)
|
||||
{
|
||||
[self showProjectLoadedFiles:self];
|
||||
}
|
||||
[loadedFilesButton setEnabled:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSPanel *buildPanel = [[project projectManager] buildPanel];
|
||||
NSPanel *launchPanel = [[project projectManager] launchPanel];
|
||||
|
||||
// Project Build
|
||||
if ([buildPanel isVisible] == YES)
|
||||
{
|
||||
[self showProjectBuild:self];
|
||||
}
|
||||
// Project Launch
|
||||
if ([launchPanel isVisible] == YES)
|
||||
{
|
||||
[self showProjectLaunch:self];
|
||||
}
|
||||
// Loaded Files
|
||||
if ([[v_split subviews] count] == 1)
|
||||
{
|
||||
[self showProjectLoadedFiles:self];
|
||||
}
|
||||
[loadedFilesButton setEnabled:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)browserDidSetPath:(NSNotification *)aNotif
|
||||
|
@ -690,8 +661,9 @@
|
|||
|
||||
- (void)makeKeyAndOrderFront:(id)sender
|
||||
{
|
||||
// PCLogInfo(self, @"makeKeyAndOrderFront sender: %@", [sender className]);
|
||||
[projectWindow makeKeyAndOrderFront:nil];
|
||||
// PCLogInfo(self, @"makeKeyAndOrderFront % @ sender: %@", [projectWindow title], [sender className]);
|
||||
// NSLog(@"makeKeyAndOrderFront %@ sender: %@", [projectWindow title], [sender className]);
|
||||
[projectWindow makeKeyAndOrderFront:self];
|
||||
}
|
||||
|
||||
- (void)makeKeyWindow
|
||||
|
@ -748,8 +720,6 @@
|
|||
|
||||
/* PCLogInfo(self, @"windowDidBecomeKey: activeSubproject %@",
|
||||
[[project activeSubproject] projectName]);*/
|
||||
NSLog(@"windowDidBecomeKey: project %@",
|
||||
[project projectName]);
|
||||
|
||||
if ([[project projectManager] rootActiveProject] != project)
|
||||
{
|
||||
|
@ -790,6 +760,18 @@
|
|||
{
|
||||
}
|
||||
|
||||
- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window
|
||||
{
|
||||
id responder;
|
||||
|
||||
responder = [window firstResponder];
|
||||
if ([responder conformsToProtocol: @protocol(CodeEditorView)])
|
||||
{
|
||||
return [[responder editor] windowWillReturnUndoManager: window];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ==== SplitView delegate
|
||||
// ============================================================================
|
||||
|
@ -801,9 +783,14 @@
|
|||
NSDictionary *projectDict = nil;
|
||||
NSDictionary *windowsDict = nil;
|
||||
NSString *browserString = nil;
|
||||
NSRect browserRect;
|
||||
NSRect browserRect = NSMakeRect(0,0,0,0);
|
||||
NSRect boxRect;
|
||||
|
||||
// NSLog(@"resizeVerticalSubiewsWithOldSize entered split view width: %f, height %f", splitSize.width, splitSize.height);
|
||||
|
||||
boxRect = [v_split frame];
|
||||
[v_split setFrame:boxRect];
|
||||
|
||||
if (splitSize.width == oldSize.width && splitSize.height == oldSize.height)
|
||||
{
|
||||
return;
|
||||
|
@ -815,7 +802,7 @@
|
|||
if (!_splitViewsRestored)
|
||||
{
|
||||
projectDict = [project projectDict];
|
||||
windowsDict = [projectDict objectForKey:@"PC_WINDOWS"];
|
||||
windowsDict = [projectDict objectForKey:PCWindows];
|
||||
if (windowsDict != nil)
|
||||
{
|
||||
browserString = [windowsDict objectForKey:@"ProjectBrowser"];
|
||||
|
@ -824,38 +811,51 @@
|
|||
browserRect = NSRectFromString(browserString);
|
||||
}
|
||||
}
|
||||
else
|
||||
// Unable to restore browser frame
|
||||
if (browserRect.size.width == 0 && browserRect.size.height == 0)
|
||||
{
|
||||
browserRect = NSMakeRect(0, 0, splitSize.width, splitSize.height);
|
||||
}
|
||||
[browserView setFrame:browserRect];
|
||||
}
|
||||
|
||||
// Use saved frame of ProjectBrowser only first time. Every time window is
|
||||
// resized use new size of subviews.
|
||||
if (_splitViewsRestored)
|
||||
/* if (_splitViewsRestored)
|
||||
{
|
||||
browserRect = [[[project projectBrowser] view] frame];
|
||||
browserRect.size.height = splitSize.height;
|
||||
if (![self hasLoadedFilesView])
|
||||
if ([[prefs objectForKey:UseTearOffWindows] isEqualToString:@"YES"])
|
||||
{
|
||||
browserRect.size.width = splitSize.width;
|
||||
}
|
||||
}
|
||||
|
||||
// Browser
|
||||
// NSLog(@"browser %@", NSStringFromRect(browserRect));
|
||||
[browserView setFrame:browserRect];
|
||||
NSLog(@"%@ browser %@",
|
||||
[project projectName], NSStringFromRect(browserRect));
|
||||
[browserView setFrame:browserRect];*/
|
||||
|
||||
// Loaded Files
|
||||
if ([self hasLoadedFilesView])
|
||||
/* if ([[prefs objectForKey:UseTearOffWindows] isEqualToString:@"NO"])
|
||||
{
|
||||
boxRect.origin.x = browserRect.size.width + [v_split dividerThickness];
|
||||
boxRect.origin.y = 0;
|
||||
boxRect.size.width = [v_split frame].size.width - boxRect.origin.x;
|
||||
boxRect.size.height = [v_split frame].size.height;
|
||||
// NSLog(@"loadedFiles %@", NSStringFromRect(boxRect));
|
||||
|
||||
if (boxRect.size.width < 60)
|
||||
{
|
||||
boxRect.size.width = 60;
|
||||
boxRect.origin.x = [v_split frame].size.width - boxRect.size.width;
|
||||
}
|
||||
|
||||
NSLog(@"%@ loadedFiles %@",
|
||||
[project projectName], NSStringFromRect(boxRect));
|
||||
[[[project projectLoadedFiles] componentView] setFrame:boxRect];
|
||||
}
|
||||
}*/
|
||||
|
||||
[v_split adjustSubviews];
|
||||
|
||||
_splitViewsRestored = YES;
|
||||
}
|
||||
|
@ -868,6 +868,8 @@
|
|||
NSRect vSplitRect;
|
||||
NSRect boxRect;
|
||||
|
||||
// NSLog(@"resizeHorizontalSubiewsWithOldSize entered split view width: %f, height %f", splitSize.width, splitSize.height);
|
||||
|
||||
if (splitSize.width == oldSize.width && splitSize.height == oldSize.height)
|
||||
{
|
||||
return;
|
||||
|
@ -881,25 +883,27 @@
|
|||
vSplitRect = [browserView frame];
|
||||
vSplitRect.origin.x = 0;
|
||||
vSplitRect.origin.y = 0;
|
||||
if (![self hasCustomView])
|
||||
/* if (![self hasCustomView])
|
||||
{
|
||||
vSplitRect.size = hSplitSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
{*/
|
||||
vSplitRect.size.width = hSplitSize.width;
|
||||
}
|
||||
/* }*/
|
||||
vSplitRect = [browserView centerScanRect: vSplitRect];
|
||||
[v_split setFrame:vSplitRect];
|
||||
|
||||
// Custom view (Editor|Builder|Launcher)
|
||||
if ([self hasCustomView])
|
||||
{
|
||||
/* if ([self hasCustomView])
|
||||
{*/
|
||||
boxRect.origin.x = 0;
|
||||
boxRect.origin.y = vSplitRect.size.height + [h_split dividerThickness];
|
||||
boxRect.size.width = hSplitSize.width;
|
||||
boxRect.size.height = hSplitSize.height - boxRect.origin.y;
|
||||
boxRect = [customView centerScanRect: boxRect];
|
||||
[customView setFrame:boxRect];
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
- (void) splitView:(NSSplitView *)sender
|
||||
|
|
163
Framework/PCSaveModified.m
Normal file
163
Framework/PCSaveModified.m
Normal file
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2000-2004 Free Software Foundation
|
||||
|
||||
Authors: Philippe C.D. Robert
|
||||
Serg Stoyan
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#import <ProjectCenter/PCEditorManager.h>
|
||||
|
||||
#import <ProjectCenter/PCSaveModified.h>
|
||||
|
||||
BOOL PCRunSaveModifiedFilesPanel(PCEditorManager *manager,
|
||||
NSString *defaultText,
|
||||
NSString *alternateText,
|
||||
NSString *otherText)
|
||||
{
|
||||
PCSaveModified *saveModifiedPanel;
|
||||
BOOL result;
|
||||
|
||||
if (!(saveModifiedPanel = [[PCSaveModified alloc] init]))
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
result = [saveModifiedPanel saveFilesWithEditorManager:manager
|
||||
defaultButtonText:defaultText
|
||||
alternateButtonText:alternateText
|
||||
otherButtonText:otherText];
|
||||
RELEASE(saveModifiedPanel);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@implementation PCSaveModified
|
||||
|
||||
- (BOOL)saveFilesWithEditorManager:(PCEditorManager *)manager
|
||||
defaultButtonText:(NSString *)defaultText
|
||||
alternateButtonText:(NSString *)alternateText
|
||||
otherButtonText:(NSString *)otherText
|
||||
{
|
||||
if ([NSBundle loadNibNamed:@"SaveModified" owner:self] == NO)
|
||||
{
|
||||
NSLog(@"Error loading SaveModified NIB file!");
|
||||
return NO;
|
||||
}
|
||||
|
||||
editorManager = manager;
|
||||
|
||||
// Table
|
||||
[filesList setCornerView:nil];
|
||||
[filesList setHeaderView:nil];
|
||||
[filesList setDataSource:self];
|
||||
[filesList setTarget:self];
|
||||
[filesList selectAll:self];
|
||||
[filesList reloadData];
|
||||
|
||||
// Buttons
|
||||
[defaultButton setTitle:defaultText];
|
||||
[alternateButton setTitle:alternateText];
|
||||
[otherButton setTitle:otherText];
|
||||
|
||||
[panel makeKeyAndOrderFront:self];
|
||||
|
||||
[NSApp runModalForWindow:panel];
|
||||
|
||||
if (clickedButton == defaultButton)
|
||||
{
|
||||
[self saveSelectedFiles];
|
||||
return YES;
|
||||
}
|
||||
else if (clickedButton == alternateButton)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
else if (clickedButton == otherButton)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
#ifdef DEBUG
|
||||
NSLog(@"PCSaveModified: dealloc");
|
||||
#endif
|
||||
RELEASE(panel);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL)saveSelectedFiles
|
||||
{
|
||||
NSArray *modifiedFiles = [editorManager modifiedFiles];
|
||||
NSIndexSet *selectedRows = [filesList selectedRowIndexes];
|
||||
NSArray *filesToSave = [modifiedFiles objectsAtIndexes:selectedRows];
|
||||
NSEnumerator *enumerator = [filesToSave objectEnumerator];
|
||||
NSString *filePath = nil;
|
||||
|
||||
NSLog(@"SaveModified|filesToSave: %@", filesToSave);
|
||||
|
||||
while ((filePath = [enumerator nextObject]))
|
||||
{
|
||||
[[editorManager editorForFile:filePath] saveFileIfNeeded];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)buttonClicked:(id)sender
|
||||
{
|
||||
clickedButton = sender;
|
||||
[NSApp stopModal];
|
||||
[panel close];
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ==== TableView delegate
|
||||
// ============================================================================
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
|
||||
{
|
||||
if (aTableView != filesList)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return [[editorManager modifiedFiles] count];
|
||||
}
|
||||
|
||||
- (id) tableView:(NSTableView *)aTableView
|
||||
objectValueForTableColumn:(NSTableColumn *)aTableColumn
|
||||
row:(NSInteger)rowIndex
|
||||
{
|
||||
if (aTableView != filesList)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [[[editorManager modifiedFiles] objectAtIndex:rowIndex] lastPathComponent];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#include "$FILENAME$.h"
|
||||
#import "$FILENAME$.h"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#ifndef _$UCFILENAME$_H_
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#include "$FILENAME$.h"
|
||||
#import "$FILENAME$.h"
|
||||
|
||||
@implementation $FILENAME$
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#ifndef _$UCFILENAME$_H_
|
||||
#define _$UCFILENAME$_H_
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface $FILENAME$ : NSObject
|
||||
{
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
Project: $PROJECTNAME$
|
||||
|
||||
Copyright (C) 2002-2004 Free Software Foundation
|
||||
Copyright (C) $YEAR$ Free Software Foundation
|
||||
|
||||
Authors: Philippe C.D. Robert
|
||||
Serg Stoyan
|
||||
Author: $FULLUSERNAME$
|
||||
|
||||
This file is part of GNUstep.
|
||||
Created: $DATE$ by $USERNAME$
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
|
@ -20,24 +19,17 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#ifndef _PCSplitView_h_
|
||||
#define _PCSplitView_h_
|
||||
#import "$FILENAME$.h"
|
||||
|
||||
#include <AppKit/NSSplitView.h>
|
||||
// This is an Obj-C++ file... add what you need to mighty Objective-C
|
||||
|
||||
@interface PCSplitView : NSSplitView
|
||||
{
|
||||
// if you need, add your C++ classes
|
||||
|
||||
}
|
||||
|
||||
- (float)dividerThickness;
|
||||
|
||||
- (void)drawDividerInRect:(NSRect)aRect;
|
||||
@implementation $FILENAME$
|
||||
|
||||
@end
|
||||
|
||||
#endif // _PCSplitView_h_
|
||||
|
||||
// add your C++ methods here
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
@protocol $FILENAME$ <NSObject>
|
||||
|
|
21
GNUmakefile
21
GNUmakefile
|
@ -9,14 +9,14 @@ ifeq ($(GNUSTEP_MAKEFILES),)
|
|||
$(error You need to set GNUSTEP_MAKEFILES before compiling!)
|
||||
endif
|
||||
|
||||
GNUSTEP_INSTALLATION_DOMAIN = SYSTEM
|
||||
PACKAGE_NAME = ProjectCenter
|
||||
export PACKAGE_NAME
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
|
||||
#
|
||||
# Main application
|
||||
#
|
||||
VERSION = 0.5.0
|
||||
PACKAGE_NAME = ProjectCenter
|
||||
VERSION = 0.7.0
|
||||
APP_NAME = ProjectCenter
|
||||
ProjectCenter_APPLICATION_ICON = Images/ProjectCenter.tiff
|
||||
|
||||
|
@ -89,7 +89,12 @@ Modules/Projects/Library/Library.project \
|
|||
Modules/Projects/ResourceSet/ResourceSet.project \
|
||||
Modules/Projects/Tool/Tool.project \
|
||||
Modules/Editors/ProjectCenter/ProjectCenter.editor \
|
||||
Modules/Parsers/ProjectCenter/ProjectCenter.parser
|
||||
Modules/Parsers/ProjectCenter/ProjectCenter.parser \
|
||||
Modules/Debuggers/ProjectCenter/ProjectCenter.debugger \
|
||||
Modules/Preferences/Build/Build.preferences \
|
||||
Modules/Preferences/Saving/Saving.preferences \
|
||||
Modules/Preferences/Misc/Misc.preferences \
|
||||
Modules/Preferences/EditorFSC/EditorFSC.preferences
|
||||
|
||||
#
|
||||
# Localization
|
||||
|
@ -97,7 +102,7 @@ Modules/Parsers/ProjectCenter/ProjectCenter.parser
|
|||
ProjectCenter_LOCALIZED_RESOURCE_FILES = \
|
||||
ProjectCenter.gorm \
|
||||
Info.gorm \
|
||||
FindPanel.gorm
|
||||
Preferences.gorm
|
||||
|
||||
ProjectCenter_LANGUAGES = \
|
||||
English
|
||||
|
@ -109,7 +114,8 @@ English
|
|||
ProjectCenter_HEADERS = \
|
||||
Headers/PCAppController.h \
|
||||
Headers/PCInfoController.h \
|
||||
Headers/PCMenuController.h
|
||||
Headers/PCMenuController.h \
|
||||
Headers/PCPrefController.h
|
||||
|
||||
#
|
||||
# Class files
|
||||
|
@ -118,10 +124,11 @@ ProjectCenter_OBJC_FILES = \
|
|||
PCAppController.m \
|
||||
PCInfoController.m \
|
||||
PCMenuController.m \
|
||||
TextFinder.m \
|
||||
PCPrefController.m \
|
||||
ProjectCenter_main.m
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
include $(GNUSTEP_MAKEFILES)/aggregate.make
|
||||
include $(GNUSTEP_MAKEFILES)/application.make
|
||||
-include GNUmakefile.postamble
|
||||
include $(GNUSTEP_MAKEFILES)/Master/nsis.make
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, write to the Free Software Foundation,
|
||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# 31 Milk Street #960789 Boston, MA 02196 USAA.
|
||||
|
||||
before-all::
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, write to the Free Software Foundation,
|
||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# 31 Milk Street #960789 Boston, MA 02196 USAA.
|
||||
|
||||
#
|
||||
# Flags dealing with compiling and linking
|
||||
|
@ -30,7 +30,7 @@
|
|||
ADDITIONAL_CPPFLAGS +=
|
||||
|
||||
# Additional flags to pass to the Objective-C compiler
|
||||
ADDITIONAL_OBJCFLAGS +=
|
||||
ADDITIONAL_OBJCFLAGS += -DDEVELOPMENT
|
||||
|
||||
# Additional flags to pass to the C compiler
|
||||
ADDITIONAL_CFLAGS +=
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2001 Free Software Foundation
|
||||
Copyright (C) 2001-2012 Free Software Foundation
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
|
@ -17,13 +17,13 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#ifndef _PCAPPCONTROLLER_H
|
||||
#define _PCAPPCONTROLLER_H
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
@class PCProjectManager;
|
||||
@class PCFileManager;
|
||||
|
@ -72,7 +72,7 @@
|
|||
- (void)applicationWillFinishLaunching:(NSNotification *)notification;
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification;
|
||||
|
||||
- (BOOL)applicationShouldTerminate:(id)sender;
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(id)sender;
|
||||
- (void)applicationWillTerminate:(NSNotification *)notification;
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2001 Free Software Foundation
|
||||
Copyright (C) 2001-2021 Free Software Foundation
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
|
@ -17,18 +17,20 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#ifndef _PCINFOCONTROLLER_H
|
||||
#define _PCINFOCONTROLLER_H
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
@interface PCInfoController : NSObject
|
||||
{
|
||||
id infoWindow;
|
||||
NSDictionary *infoDict;
|
||||
id infoWindow;
|
||||
IBOutlet NSTextField* versionField;
|
||||
IBOutlet NSTextField* copyrightField;
|
||||
NSDictionary *infoDict;
|
||||
}
|
||||
|
||||
- (id)init;
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#ifndef _PCMENUCONTROLLER_H
|
||||
#define _PCMENUCONTROLLER_H
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
@class PCProjectManager;
|
||||
@class PCFileManager;
|
||||
|
@ -81,11 +81,6 @@
|
|||
- (void)fileRename:(id)sender;
|
||||
- (void)fileNewUntitled:(id)sender;
|
||||
|
||||
// Edit
|
||||
/*- (void)findShowPanel:(id)sender;
|
||||
- (void)findNext:(id)sender;
|
||||
- (void)findPrevious:(id)sender;*/
|
||||
|
||||
// Tools
|
||||
- (void)showInspector:(id)sender;
|
||||
- (void)showEditorPanel:(id)sender;
|
||||
|
|
55
Headers/PCPrefController.h
Normal file
55
Headers/PCPrefController.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2001-2008 Free Software Foundation
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#ifndef _PCPREFCONTROLLER_H
|
||||
#define _PCPREFCONTROLLER_H
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#import <Protocols/Preferences.h>
|
||||
|
||||
@interface PCPrefController : NSObject <PCPreferences>
|
||||
{
|
||||
NSMutableDictionary *sectionsDict;
|
||||
|
||||
IBOutlet NSPanel *panel;
|
||||
IBOutlet NSPopUpButton *popupButton;
|
||||
IBOutlet NSBox *sectionsView;
|
||||
|
||||
IBOutlet NSBox *bundlesView;
|
||||
IBOutlet NSTextField *bundlePathField;
|
||||
}
|
||||
|
||||
+ (PCPrefController *)sharedPCPreferences;
|
||||
|
||||
- (id)init;
|
||||
- (void)dealloc;
|
||||
|
||||
- (void)loadPrefsSections;
|
||||
- (void)showPanel:(id)sender;
|
||||
|
||||
- (void)popupChanged:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -19,14 +19,14 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#ifndef _PCAddFilesPanel_h_
|
||||
#define _PCAddFilesPanel_h_
|
||||
|
||||
//#include <Foundation/Foundation.h>
|
||||
#include <AppKit/AppKit.h>
|
||||
//#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
@interface PCAddFilesPanel : NSOpenPanel
|
||||
{
|
||||
|
|
29
Headers/ProjectCenter/PCAuxiliaryWindow.h
Normal file
29
Headers/ProjectCenter/PCAuxiliaryWindow.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
PCAuxiliaryWindow.h
|
||||
|
||||
Author: German A. Arias <germanandre@gmx.es>
|
||||
Date: September 2013
|
||||
|
||||
This file is part of ProjectCenter.
|
||||
|
||||
ProjectCenter is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This application is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
@interface PCAuxiliaryWindow : NSWindow
|
||||
{
|
||||
}
|
||||
@end
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#ifndef _PCBundleManager_h_
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/*
|
||||
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
|
||||
|
||||
Copyright (C) 2003-2004 Free Software Foundation
|
||||
Copyright (C) 2003-2019 Free Software Foundation
|
||||
|
||||
Authors: Serg Stoyan
|
||||
Riccardo Mottola
|
||||
|
||||
This file is part of GNUstep.
|
||||
This file is part of ProjectCenter.
|
||||
|
||||
This application is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
|
@ -19,13 +20,13 @@
|
|||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
||||
*/
|
||||
|
||||
#ifndef _PCButton_h_
|
||||
#define _PCButton_h_
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
#import <AppKit/NSButton.h>
|
||||
|
||||
/*
|
||||
* Button
|
||||
|
@ -33,14 +34,6 @@
|
|||
|
||||
@interface PCButton : NSButton
|
||||
{
|
||||
NSToolTipTag mainToolTip;
|
||||
|
||||
NSTimer *ttTimer;
|
||||
NSWindow *ttWindow;
|
||||
NSMutableDictionary *ttTitleAttrs;
|
||||
NSColor *ttBackground;
|
||||
|
||||
BOOL _hasTooltips;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue