Removed Common directory, T++ stylesheets replaced by templates

git-svn-id: svn://ultimatepp.org/upp/trunk@341 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2008-08-16 13:50:40 +00:00
parent 8fa1f2a057
commit f1c9e4d210
24 changed files with 335 additions and 395 deletions

View file

@ -1,59 +1,51 @@
TOPIC("VectorMap$en-us")
#include "VectorMap$en-us.tpp"
END_TOPIC
TOPIC("Vector$en-us")
#include "Vector$en-us.tpp"
END_TOPIC
TOPIC("Convert$en-us")
#include "Convert$en-us.tpp"
END_TOPIC
TOPIC("Format$en-us")
#include "Format$en-us.tpp"
END_TOPIC
TOPIC("Segtor$en-us")
#include "Segtor$en-us.tpp"
END_TOPIC
TOPIC("ArrayIndex$en-us")
#include "ArrayIndex$en-us.tpp"
END_TOPIC
TOPIC("String$en-us")
#include "String$en-us.tpp"
END_TOPIC
TOPIC("Indext$en-us")
#include "Indext$en-us.tpp"
TOPIC("Thread$en-us")
#include "Thread$en-us.tpp"
END_TOPIC
TOPIC("BiVector$en-us")
#include "BiVector$en-us.tpp"
TOPIC("AIndex$en-us")
#include "AIndex$en-us.tpp"
END_TOPIC
TOPIC("BiArray$en-us")
#include "BiArray$en-us.tpp"
TOPIC("Buffer$en-us")
#include "Buffer$en-us.tpp"
END_TOPIC
TOPIC("ArrayMap$en-us")
#include "ArrayMap$en-us.tpp"
END_TOPIC
TOPIC("ArrayIndex$en-us")
#include "ArrayIndex$en-us.tpp"
TOPIC("BiVector$en-us")
#include "BiVector$en-us.tpp"
END_TOPIC
TOPIC("util$en-us")
#include "util$en-us.tpp"
END_TOPIC
TOPIC("Color$en-us")
#include "Color$en-us.tpp"
END_TOPIC
TOPIC("Array$en-us")
#include "Array$en-us.tpp"
END_TOPIC
TOPIC("algo$en-us")
#include "algo$en-us.tpp"
END_TOPIC
TOPIC("AIndex$en-us")
#include "AIndex$en-us.tpp"
END_TOPIC
TOPIC("AMap$en-us")
#include "AMap$en-us.tpp"
END_TOPIC
@ -62,28 +54,52 @@ TOPIC("PtePtr$en-us")
#include "PtePtr$en-us.tpp"
END_TOPIC
TOPIC("DateFmt$en-us")
#include "DateFmt$en-us.tpp"
END_TOPIC
TOPIC("One$en-us")
#include "One$en-us.tpp"
END_TOPIC
TOPIC("Any$en-us")
#include "Any$en-us.tpp"
END_TOPIC
TOPIC("Stream$en-us")
#include "Stream$en-us.tpp"
TOPIC("Callbacks$en-us")
#include "Callbacks$en-us.tpp"
END_TOPIC
TOPIC("StreamFn$en-us")
#include "StreamFn$en-us.tpp"
END_TOPIC
TOPIC("Buffer$en-us")
#include "Buffer$en-us.tpp"
TOPIC("Convert$en-us")
#include "Convert$en-us.tpp"
END_TOPIC
TOPIC("One$en-us")
#include "One$en-us.tpp"
END_TOPIC
TOPIC("algo$en-us")
#include "algo$en-us.tpp"
END_TOPIC
TOPIC("DateFmt$en-us")
#include "DateFmt$en-us.tpp"
END_TOPIC
TOPIC("Any$en-us")
#include "Any$en-us.tpp"
END_TOPIC
TOPIC("Format$en-us")
#include "Format$en-us.tpp"
END_TOPIC
TOPIC("BiArray$en-us")
#include "BiArray$en-us.tpp"
END_TOPIC
TOPIC("Indext$en-us")
#include "Indext$en-us.tpp"
END_TOPIC
TOPIC("Stream$en-us")
#include "Stream$en-us.tpp"
END_TOPIC
TOPIC("NetNode$en-us")
#include "NetNode$en-us.tpp"
END_TOPIC
TOPIC("SerializationUtils$en-us")
@ -94,23 +110,7 @@ TOPIC("CParser$en-us")
#include "CParser$en-us.tpp"
END_TOPIC
TOPIC("util$en-us")
#include "util$en-us.tpp"
END_TOPIC
TOPIC("Callbacks$en-us")
#include "Callbacks$en-us.tpp"
END_TOPIC
TOPIC("Color$en-us")
#include "Color$en-us.tpp"
END_TOPIC
TOPIC("Thread$en-us")
#include "Thread$en-us.tpp"
END_TOPIC
TOPIC("NetNode$en-us")
#include "NetNode$en-us.tpp"
TOPIC("VectorMap$en-us")
#include "VectorMap$en-us.tpp"
END_TOPIC

View file

@ -1,72 +1,72 @@
TOPIC("Tutorial$en-us")
#include "Tutorial$en-us.tpp"
END_TOPIC
TOPIC("BRC$en-us")
#include "BRC$en-us.tpp"
END_TOPIC
TOPIC("Caveats$en-us")
#include "Caveats$en-us.tpp"
END_TOPIC
TOPIC("Charset$en-us")
#include "Charset$en-us.tpp"
END_TOPIC
TOPIC("Configuration$en-us")
#include "Configuration$en-us.tpp"
END_TOPIC
TOPIC("CoreTutorial$en-us")
#include "CoreTutorial$en-us.tpp"
END_TOPIC
TOPIC("Decisions$en-us")
#include "Decisions$en-us.tpp"
END_TOPIC
TOPIC("DLI$en-us")
#include "DLI$en-us.tpp"
END_TOPIC
TOPIC("i18n$en-us")
#include "i18n$en-us.tpp"
END_TOPIC
TOPIC("Moveable$en-us")
#include "Moveable$en-us.tpp"
END_TOPIC
TOPIC("NTL$en-us")
#include "NTL$en-us.tpp"
END_TOPIC
TOPIC("NTLvsSTL$en-us")
#include "NTLvsSTL$en-us.tpp"
END_TOPIC
TOPIC("Packages$en-us")
#include "Packages$en-us.tpp"
END_TOPIC
TOPIC("PickTypes$en-us")
#include "PickTypes$en-us.tpp"
END_TOPIC
TOPIC("pick_$en-us")
#include "pick_$en-us.tpp"
END_TOPIC
TOPIC("std$en-us")
#include "std$en-us.tpp"
END_TOPIC
TOPIC("Translating$en-us")
#include "Translating$en-us.tpp"
END_TOPIC
TOPIC("Tutorial$en-us")
#include "Tutorial$en-us.tpp"
END_TOPIC
TOPIC("UserValue$en-us")
#include "UserValue$en-us.tpp"
END_TOPIC
TOPIC("PickTypes$en-us")
#include "PickTypes$en-us.tpp"
END_TOPIC
TOPIC("CoreTutorial$en-us")
#include "CoreTutorial$en-us.tpp"
END_TOPIC
TOPIC("Packages$en-us")
#include "Packages$en-us.tpp"
END_TOPIC
TOPIC("i18n$en-us")
#include "i18n$en-us.tpp"
END_TOPIC
TOPIC("Decisions$en-us")
#include "Decisions$en-us.tpp"
END_TOPIC
TOPIC("pick_$en-us")
#include "pick_$en-us.tpp"
END_TOPIC
TOPIC("Translating$en-us")
#include "Translating$en-us.tpp"
END_TOPIC
TOPIC("Caveats$en-us")
#include "Caveats$en-us.tpp"
END_TOPIC
TOPIC("NTLvsSTL$en-us")
#include "NTLvsSTL$en-us.tpp"
END_TOPIC
TOPIC("Charset$en-us")
#include "Charset$en-us.tpp"
END_TOPIC
TOPIC("Moveable$en-us")
#include "Moveable$en-us.tpp"
END_TOPIC
TOPIC("std$en-us")
#include "std$en-us.tpp"
END_TOPIC
TOPIC("NTL$en-us")
#include "NTL$en-us.tpp"
END_TOPIC

View file

@ -1,8 +1,8 @@
TOPIC("Heap$en-us")
#include "Heap$en-us.tpp"
END_TOPIC
TOPIC("String$en-us")
#include "String$en-us.tpp"
END_TOPIC
TOPIC("Heap$en-us")
#include "Heap$en-us.tpp"
END_TOPIC

View file

@ -3,7 +3,7 @@
#include "CtrlCore/init"
#include "RichText/init"
#include "PdfDraw/init"
#define BLITZ_INDEX__ F9591244744ADAA29768E46A610ADBF23
#define BLITZ_INDEX__ F6FEA1B844ACA471A4C8DF3B2E28C3ACB
#include "CtrlLib.icpp"
#undef BLITZ_INDEX__
#endif

View file

@ -0,0 +1,35 @@
init_
pick_
WINAPI
CALLBACK
_CRTIMP2
_CRTIMP
__cdecl
__fastcall
WINOLEAPI
FAR
NEAR
__CLR_OR_THIS_CALL
__inline
__CRTDECL
_CRT_INSECURE_DEPRECATE_GLOBALS
_CRT_INSECURE_DEPRECATE
_STDEXT
ISOLATION_AWARE_INLINE
WINUSERAPI
WINAPIV
__in
__out
__inout
_STD
_MRTIMP2
FARPROC
APIENTRY
_SCL_INSECURE_DEPRECATE
__thiscall
_CRTIMP_PURE
_CRT_JIT_INTRINSIC
__CLRCALL_OR_CDECL
_CRTIMP2_PURE_DEBUG_IT
_CRTIMP2_PURE
__declspec

View file

@ -156,7 +156,7 @@ void LoadBrowserBase(Progress& pi)
Vector<String> IgnoreList()
{
Vector<String> ignore;
FileIn in(CommonPath("dppignore.txt"));
FileIn in(IgnoreFile());
while(!in.IsEof()) {
String s = in.GetLine();
if(!s.IsEmpty())

View file

@ -286,7 +286,7 @@ protected:
String grouppath;
String topicpath;
static String laststylesheet;
static String lasttemplate;
static int lastlang;
static bool allfonts;
@ -306,7 +306,6 @@ protected:
void TopicMenu(Bar& bar);
void MainTool(Bar& bar);
void FileBar(Bar& bar);
void StyleSheetMenu(Bar& bar);
void Exit();
void SetBar();
@ -324,9 +323,10 @@ protected:
void TopicCursor();
int Execute(StyleDlg& d);
void EditStylesheets();
void StoreStylesheet();
void ListTemplates(Vector<String>& path, Vector<String>& name);
String ChooseTemplate(const char *title);
void SaveAsTemplate();
void ApplyStylesheet();
void ApplyStylesheetGroup();
@ -351,6 +351,8 @@ protected:
void CompressGroup();
public:
Callback1<Bar&> WhenTemplatesMenu;
enum {
TIMEID_AUTOSAVE = Ctrl::TIMEID_COUNT,
TIMEID_COUNT

View file

@ -1,144 +1,54 @@
#include "Browser.h"
struct StyleDlg : public WithStylesheetLayout<TopWindow> {
virtual bool Accept();
EditString editname;
void Edit();
void Load();
void Save();
String CommonFile(const char *s) { return AppendFileName(GetCommonDir(), s); }
typedef StyleDlg CLASSNAME;
StyleDlg();
};
void StyleDlg::Edit()
void TopicEditor::ListTemplates(Vector<String>& path, Vector<String>& name)
{
if(!style.IsCursor())
return;
RichEdit e;
e.SetQTF((String)style.Get(1));
e.Styles();
style.Set(1, StylesAsQTF(e.Get()));
}
void StyleDlg::Load()
{
style.Clear();
FindFile ff(CommonFile("*.style"));
while(ff) {
style.Add(GetFileTitle(ff.GetName()), LoadFile(CommonFile(ff.GetName())));
ff.Next();
}
style.Sort();
style.GoBegin();
}
bool StyleDlg::Accept()
{
if(!TopWindow::Accept())
return false;
Index<String> nm;
for(int i = 0; i < style.GetCount(); i++) {
String n = style.Get(i, 0);
if(nm.Find(n) >= 0) {
Exclamation("Duplicate style [* " + DeQtf(n) + "] !");
return false;
Vector<String> ud = GetUppDirs();
for(int i = 0; i < ud.GetCount(); i++) {
String nest = ud[i];
String tmpl = AppendFileName(nest, "$.tpp");
FindFile ff(AppendFileName(tmpl, "*.tpp"));
while(ff) {
if(ff.IsFile()) {
path.Add(AppendFileName(tmpl, ff.GetName()));
name.Add(GetFileTitle(ff.GetName()) + " (in " + GetFileTitle(nest) + ")");
}
ff.Next();
}
}
return true;
IndexSort(name, path);
}
void StyleDlg::Save()
String TopicEditor::ChooseTemplate(const char *title)
{
Index<String> saved;
for(int i = 0; i < style.GetCount(); i++) {
String fn = CommonFile((String)style.Get(i, 0) + ".style");
saved.Add(fn);
String st = style.Get(i, 1);
if(LoadFile(fn) != st)
SaveFile(fn, st);
}
FindFile ff(CommonFile("*.style"));
while(ff) {
String fn = CommonFile(ff.GetName());
if(saved.Find(fn) < 0)
DeleteFile(fn);
ff.Next();
}
}
StyleDlg::StyleDlg()
{
CtrlLayoutOKCancel(*this, "Stylesheets");
edit <<= THISBACK(Edit);
style.NoHeader();
style.AddColumn().Edit(editname);
style.AddIndex().InsertValue("[%EN-US3 $$0,0#00000000000000000000000000000000:Default]");
style.Inserting().Removing().Duplicating().NoAppendLine();
editname.NotNull();
editname.MaxLen(30);
editname.SetFilter(CharFilterID);
}
int TopicEditor::Execute(StyleDlg& d)
{
d.Load();
d.style.FindSetCursor(laststylesheet);
if(!d.style.IsCursor())
d.style.GoBegin();
return d.Run();
}
void TopicEditor::EditStylesheets()
{
StyleDlg d;
if(Execute(d) == IDOK) {
d.Save();
if(d.style.IsCursor())
laststylesheet = d.style.GetKey();
}
}
void TopicEditor::StoreStylesheet()
{
StyleDlg d;
d.Title("Store as stylesheet");
d.edit.Hide();
if(Execute(d) == IDOK) {
if(d.style.IsCursor()) {
d.style.Set(1, AsQTF(editor.Get(), CHARSET_UTF8, QTF_ALL_STYLES));
laststylesheet = d.style.GetKey();
}
d.Save();
}
WithTemplateListLayout<TopWindow> dlg;
CtrlLayoutOKCancel(dlg, title);
Vector<String> path, name;
ListTemplates(path, name);
dlg.list.AddIndex();
dlg.list.AddColumn();
for(int i = 0; i < path.GetCount(); i++)
dlg.list.Add(path[i], name[i]);
dlg.list.GoBegin();
if(dlg.Execute() != IDOK)
return Null;
return dlg.list.GetKey();
}
void TopicEditor::ApplyStylesheet()
{
if(!topic.IsCursor())
return;
StyleDlg d;
d.Title("Apply stylesheet to current topic");
d.edit.Hide();
if(Execute(d) != IDOK)
return;
d.Save();
editor.ApplyStylesheet(ParseQTF((String)d.style.Get(1)));
String t = ChooseTemplate("Apply template stylesheet");
if(t.GetCount())
editor.ApplyStylesheet(ParseQTF(LoadFile(t)));
}
void TopicEditor::ApplyStylesheetGroup()
{
StyleDlg d;
d.Title("Apply stylesheet to current group");
d.edit.Hide();
if(Execute(d) != IDOK)
String t = ChooseTemplate("Apply template stylesheet to current group");
if(IsNull(t))
return;
d.Save();
RichText ss = ParseQTF((String)d.style.Get(1));
RichText ss = ParseQTF(LoadFile(t));
int c = topic.GetCursor();
Progress pi("Applying stylesheet");
for(int i = 0; i < topic.GetCount(); i++) {

View file

@ -3,7 +3,7 @@
ArrayMap<String, TopicEditor::FileInfo> TopicEditor::editstate;
VectorMap<String, String> TopicEditor::grouptopic;
String TopicEditor::laststylesheet;
String TopicEditor::lasttemplate;
int TopicEditor::lastlang;
bool TopicEditor::allfonts;

View file

@ -2,28 +2,24 @@ LAYOUT(NewTopicLayout, 268, 92)
ITEM(Label, dv___0, SetLabel(t_("Topic")).LeftPosZ(8, 56).TopPosZ(8, 19))
ITEM(EditString, topic, LeftPosZ(68, 92).TopPosZ(8, 19))
ITEM(LNGCtrl, lang, LeftPosZ(164, 96).TopPosZ(8, 19))
ITEM(Label, dv___3, SetLabel(t_("Stylesheet")).LeftPosZ(8, 56).TopPosZ(32, 19))
ITEM(DropList, stylesheet, LeftPosZ(68, 192).TopPosZ(32, 19))
ITEM(Label, dv___3, SetLabel(t_("Template")).LeftPosZ(8, 56).TopPosZ(32, 19))
ITEM(DropList, tmpl, LeftPosZ(68, 192).TopPosZ(32, 19))
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(128, 64).TopPosZ(60, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(196, 64).TopPosZ(60, 24))
END_LAYOUT
LAYOUT(RenameTopicLayout, 268, 64)
ITEM(Label, dv___0, SetLabel(t_("Topic")).LeftPosZ(8, 56).TopPosZ(8, 19))
ITEM(EditString, topic, LeftPosZ(68, 92).TopPosZ(8, 19))
LAYOUT(RenameTopicLayout, 268, 68)
ITEM(Label, dv___0, SetLabel(t_("Topic")).LeftPosZ(8, 48).TopPosZ(8, 19))
ITEM(EditString, topic, LeftPosZ(56, 108).TopPosZ(8, 19))
ITEM(LNGCtrl, lang, LeftPosZ(164, 96).TopPosZ(8, 19))
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(128, 64).TopPosZ(32, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(196, 64).TopPosZ(32, 24))
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(128, 64).TopPosZ(36, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(196, 64).TopPosZ(36, 24))
END_LAYOUT
LAYOUT(StylesheetLayout, 348, 344)
ITEM(ArrayCtrl, style, LeftPosZ(8, 260).TopPosZ(8, 328))
ITEM(Button, edit, SetLabel(t_("Edit..")).LeftPosZ(276, 64).TopPosZ(8, 24))
// ITEM(Button, edit, SetLabel(t_("New..")).LeftPosZ(276, 64).TopPosZ(36, 24))
// ITEM(Button, edit, SetLabel(t_("Rename..")).LeftPosZ(276, 64).TopPosZ(64, 24))
// ITEM(Button, edit, SetLabel(t_("Remove..")).LeftPosZ(276, 64).TopPosZ(92, 24))
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(276, 64).TopPosZ(284, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(276, 64).TopPosZ(312, 24))
LAYOUT(TemplateListLayout, 236, 376)
ITEM(ArrayCtrl, list, LeftPosZ(8, 220).TopPosZ(8, 328))
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(96, 64).TopPosZ(344, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(164, 64).TopPosZ(344, 24))
END_LAYOUT
LAYOUT(TopicLinkLayout, 716, 404)
@ -55,3 +51,13 @@ LAYOUT(ReferenceDlgLayout, 644, 392)
ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(8, 24))
END_LAYOUT
LAYOUT(SaveTemplateLayout, 248, 96)
ITEM(Label, dv___0, SetLabel(t_("Name")).LeftPosZ(8, 40).TopPosZ(8, 19))
ITEM(EditString, topic, LeftPosZ(48, 92).TopPosZ(8, 19))
ITEM(LNGCtrl, lang, LeftPosZ(144, 96).TopPosZ(8, 19))
ITEM(Label, dv___3, SetLabel(t_("Nest")).LeftPosZ(8, 40).TopPosZ(32, 19))
ITEM(DropList, nest, LeftPosZ(48, 192).TopPosZ(32, 19))
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(108, 64).TopPosZ(60, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(176, 64).TopPosZ(60, 24))
END_LAYOUT

View file

@ -88,7 +88,7 @@ void TopicEditor::SerializeEditPos(Stream& s)
}
s % grouptopic;
s % lastlang;
s % laststylesheet;
s % lasttemplate;
}
void TopicEditor::ExportPdf()
@ -142,6 +142,11 @@ void TopicEditor::TopicMenu(Bar& bar)
bar.Add(topic.IsCursor(), "Rename topic..", THISBACK(RenameTopic));
bar.Add(topic.IsCursor(), "Remove topic", THISBACK(RemoveTopic))
.Key(K_ALT_DELETE);
bar.Separator();
bar.Add(topic.IsCursor() && GetFileTitle(topicpath) != "$.tpp",
"Save as template..", THISBACK(SaveAsTemplate));
bar.Add(topic.IsCursor(), "Apply template stylesheet..", THISBACK(ApplyStylesheet));
bar.Add("Apply template stylesheet to group..", THISBACK(ApplyStylesheetGroup));
}
void TopicEditor::FileBar(Bar& bar)
@ -181,7 +186,6 @@ void TopicEditor::EditMenu(Bar& bar)
bar.Separator();
bar.Add("Table", THISBACK(TableMenu));
bar.Add("Format", THISBACK(FormatMenu));
bar.Add("Stylesheet", THISBACK(StyleSheetMenu));
}
void TopicEditor::FormatMenu(Bar& bar)
@ -208,14 +212,6 @@ void TopicEditor::TableMenu(Bar& bar)
editor.TableTools(bar);
}
void TopicEditor::StyleSheetMenu(Bar& bar)
{
bar.Add("Stylesheets..", THISBACK(EditStylesheets));
bar.Add(!IsNull(topicpath), "Store stylesheet..", THISBACK(StoreStylesheet));
bar.Add(!IsNull(topicpath), "Apply stylesheet..", THISBACK(ApplyStylesheet));
bar.Add("Apply stylesheet to group..", THISBACK(ApplyStylesheetGroup));
}
void CreateTopic(const char *fn, int lang, const String& ss)
{
SaveFile(fn, WriteTopic("", ParseQTF(ss + "[{_}%" + LNGAsText(lang) + " ")));
@ -240,24 +236,15 @@ void TopicEditor::NewTopic()
TopicDlg<WithNewTopicLayout<TopWindow> > d("New topic");
d.lang <<= lastlang;
Vector<String> name;
Vector<String> style;
name.Add("<none>");
style.Add("");
FindFile ff(AppendFileName(GetCommonDir(), "*.style"));
while(ff) {
name.Add(GetFileTitle(ff.GetName()));
style.Add(LoadFile(AppendFileName(GetCommonDir(), ff.GetName())));
ff.Next();
}
IndexSort(name, style);
for(int i = 0; i < name.GetCount(); i++)
d.stylesheet.Add(name[i]);
Vector<String> path, name;
ListTemplates(path, name);
for(int i = 0; i < path.GetCount(); i++)
d.tmpl.Add(path[i], name[i]);
if(d.stylesheet.HasKey(laststylesheet))
d.stylesheet <<= laststylesheet;
if(d.tmpl.HasKey(lasttemplate))
d.tmpl <<= lasttemplate;
else
d.stylesheet.SetIndex(0);
d.tmpl.GoBegin();
d.ActiveFocus(d.topic);
String fn;
@ -267,13 +254,12 @@ void TopicEditor::NewTopic()
fn = AppendFileName(grouppath, d.GetName());
if(!FileExists(fn))
break;
if(PromptYesNo("Topic already exists.&Do you want to clear it?"))
if(PromptYesNo("Topic already exists.&Do you want to rewrite it?"))
break;
}
laststylesheet = ~d.stylesheet;
lasttemplate = ~d.tmpl;
lastlang = ~d.lang;
int q = d.stylesheet.GetIndex();
CreateTopic(fn, ~d.lang, q >= 0 ? style[q] : Null);
CreateTopic(fn, ~d.lang, ~d.tmpl);
Flush();
Open(grouppath);
Load(fn);
@ -325,6 +311,24 @@ void TopicEditor::RemoveTopic()
editor.SetFocus();
}
void TopicEditor::SaveAsTemplate()
{
TopicDlg<WithSaveTemplateLayout<TopWindow> > d("Save as template");
d.lang <<= lastlang;
Vector<String> ud = GetUppDirs();
String p = GetCurrentTopicPath();
for(int i = 0; i < ud.GetCount(); i++) {
d.nest.Add(ud[i]);
if(p.StartsWith(ud[i]))
d.nest.SetIndex(i);
}
if(d.nest.GetIndex() < 0)
d.nest.GoBegin();
if(d.Execute() != IDOK || IsNull(~d.nest))
return;
SaveFile(AppendFileName(AppendFileName(~d.nest, "$.tpp"), d.GetName()), editor.GetQTF());
}
void TopicEditor::SetBar()
{
tool.Set(THISBACK(MainTool));

View file

@ -183,12 +183,11 @@ String SourcePath(const String& package, const String& name);
inline
String PackageDirectory(const String& name) { return GetFileDirectory(PackagePath(name)); }
String GetCommonDir();
String CommonPath(const String& filename);
String GetLocalDir();
String LocalPath(const String& filename);
String IgnoreFile();
bool IsFullDirectory(const String& d);
bool IsCSourceFile(const char *path);

View file

@ -1,18 +1,5 @@
#include "Common.h"
String GetCommonDir()
{
return GetVar("COMMON");
}
String CommonPath(const String& filename)
{
String s = GetCommonDir();
if(s.IsEmpty())
return ConfigFile(filename);
return AppendFileName(s, filename);
}
String GetLocalDir()
{
return ConfigFile("UppLocal");
@ -23,6 +10,11 @@ String LocalPath(const String& filename)
return AppendFileName(GetLocalDir(), filename);
}
String IgnoreFile()
{
return AppendFileName(GetUppDirs()[0], "cpp_parser_ignore.txt");
}
String FollowCygwinSymlink(const String& file) {
for(String fn = file;;) {
if(fn.IsEmpty())

View file

@ -230,7 +230,7 @@ Pdb::Pdb()
tree.WhenOpen = THISBACK(TreeExpand);
FileIn in(CommonPath("TreeTypes.txt"));
FileIn in(ConfigFile("TreeTypes.txt"));
while(!in.IsEof()) {
String type = in.GetLine();
String desc = in.GetLine();
@ -266,7 +266,7 @@ void Pdb::CopyDisas()
Pdb::~Pdb()
{
SaveTree();
String fn = CommonPath("TreeTypes.txt");
String fn = ConfigFile("TreeTypes.txt");
FileOut out(fn);
for(int i = 0; i < treetype.GetCount(); i++)
out << treetype.GetKey(i) << "\r\n" << treetype[i] << "\r\n";

View file

@ -15,7 +15,6 @@ private:
private:
FrameRight<Button> browse_upp;
SelectDirButton browse_out;
SelectDirButton browse_common;
bool new_base;
};
@ -23,7 +22,6 @@ bool BaseSetup(String& vars) { return BaseSetupDlg().Run(vars); }
BaseSetupDlg::BaseSetupDlg()
: browse_out("Output & intermediate files")
, browse_common("Common files")
{
CtrlLayoutOKCancel(*this, "Assembly setup");
browse_upp.SetImage(CtrlImg::right_arrow());
@ -31,14 +29,12 @@ BaseSetupDlg::BaseSetupDlg()
upp.AddFrame(browse_upp);
upp <<= THISBACK(OnUpp);
browse_out.Attach(output);
browse_common.Attach(common);
}
bool BaseSetupDlg::Run(String& vars)
{
upp <<= GetVar("UPP");
output <<= GetVar("OUTPUT");
common <<= GetVar("COMMON");
base <<= vars;
new_base = IsNull(vars);
while(TopWindow::Run() == IDOK)
@ -57,7 +53,6 @@ bool BaseSetupDlg::Run(String& vars)
}
SetVar("UPP", ~upp);
SetVar("OUTPUT", ~output);
SetVar("COMMON", ~common);
Vector<String> paths = SplitDirs(upp.GetText().ToString());
for(int i = 0; i < paths.GetCount(); i++)
RealizeDirectory(paths[i]);

View file

@ -396,6 +396,8 @@ void Ide::SetupFormat() {
edt.tabsize <<= rtvr <<=
hlt.hlstyle.WhenCtrlsAction = ed.WhenAction = tf.WhenAction =
con.WhenAction = f1.WhenAction = f2.WhenAction = dlg.Breaker(222);
edt.showtimeafter <<= (Date)FileGetTime(ConfigFile("version"));
edt.today <<= dlg.Breaker(444);
hlt.hl_restore <<= dlg.Breaker(333);
ide.chstyle.Add(0, "Host platform");
ide.chstyle.Add(1, "Standard");
@ -433,11 +435,15 @@ void Ide::SetupFormat() {
editor.DefaultHlStyles();
ReadHlStyles(hlt.hlstyle);
}
if(c == 444)
edt.showtimeafter = GetSysDate();
}
if(filelist.IsCursor()) {
FlushFile();
FileCursor();
}
FileSetTime(ConfigFile("version"), ToTime(~edt.showtimeafter));
SaveLoadPackage();
if(editor.auto_assist)
StartBrowserBase();
SyncCh();

View file

@ -359,7 +359,6 @@ void TemplateDlg::Load(const Vector<String>& p, bool main)
LoadNest(p[i], main);
nest.Add(p[i]);
}
LoadNest(GetCommonDir(), main);
LoadNest(GetLocalDir(), main);
LoadNest(GetFileFolder(ConfigFile("x")), main, false);
Sort(pt, FieldRelation(&PackageTemplate::name, StdLess<String>()));

View file

@ -112,8 +112,6 @@ struct DependsDlg : public WithUppOptPushDlg<TopWindow> {
struct WorkspaceWork {
static Font ListFont();
Time InstallTime;
FileList package;
FileList filelist;
Vector<int> fileindex;
@ -189,7 +187,7 @@ struct WorkspaceWork {
void MoveFile(int d);
void Move(Vector<String>& v, FileList& ta, int d);
enum ADDFILE { PACKAGE_FILE, OUTPUT_FILE, HOME_FILE, COMMON_FILE, LOCAL_FILE, ANY_FILE };
enum ADDFILE { PACKAGE_FILE, OUTPUT_FILE, HOME_FILE, LOCAL_FILE, ANY_FILE };
void AddFile(ADDFILE type);
void AddItem(const String& name, bool separator, bool readonly);
void AddTopicGroup();

View file

@ -132,6 +132,7 @@ void WorkspaceWork::SaveLoadPackage()
void WorkspaceWork::LoadActualPackage()
{
Time utime = FileGetTime(ConfigFile("version"));
filelist.Clear();
fileindex.Clear();
bool open = true;
@ -151,7 +152,7 @@ void WorkspaceWork::LoadActualPackage()
FindFile ff(SourcePath(GetActivePackage(), f));
if(ff) {
Time ftm = Time(ff.GetLastWriteTime());
if(ftm > InstallTime) {
if(ftm > utime) {
int64 t = tm - ftm;
if(t < 24 * 3600)
uln = SColorMark;
@ -191,7 +192,7 @@ void WorkspaceWork::PackageCursor()
actual.file.Add(String(HELPNAME));
Vector<String> d = GetUppDirs();
for(int i = 0; i < d.GetCount(); i++)
actual.file.Add(AppendFileName(d[i], "templates.tpp"));
actual.file.Add(AppendFileName(d[i], "$.tpp"));
}
else {
String pp = PackagePathA(actualpackage);
@ -244,7 +245,6 @@ void WorkspaceWork::AddFile(ADDFILE af)
if(active.IsEmpty()) return;
FileSel fss;
FileSel *fs = &OutputFs();
RealizeDirectory(GetCommonDir());
RealizeDirectory(GetLocalDir());
switch(af)
{
@ -254,7 +254,6 @@ void WorkspaceWork::AddFile(ADDFILE af)
#ifdef PLATFORM_POSIX
case HOME_FILE: fs->ActiveDir(GetHomeDirectory()); break;
#endif
case COMMON_FILE: fs->ActiveDir(GetCommonDir()); break;
case LOCAL_FILE: fs->ActiveDir(GetLocalDir()); break;
}
if(!fs->ExecuteOpen("Add files to package..")) return;
@ -538,8 +537,6 @@ void WorkspaceWork::FileMenu(Bar& menu)
.Help("Insert files from anywhere on disk (discouraged in portable packages)");
menu.Add(isaux && GetOutputDir().GetCount(), "Insert output directory file(s)", THISBACK1(AddFile, OUTPUT_FILE))
.Help("Open file selector in output / intermediate directory for current package");
menu.Add(isaux, "Insert Common directory file(s)", THISBACK1(AddFile, COMMON_FILE))
.Help("Open file selector in Common directory for current package");
menu.Add(isaux, "Insert Local directory file(s)", THISBACK1(AddFile, LOCAL_FILE))
.Help("Open file selector in Local directory for current package");
#ifdef PLATFORM_POSIX
@ -694,7 +691,6 @@ WorkspaceWork::WorkspaceWork()
package.BackPaintHint();
filelist.BackPaintHint();
showtime = false;
InstallTime = FileGetTime(ConfigFile("version"));
}
void WorkspaceWork::SerializeClosed(Stream& s)

View file

@ -1,49 +1,65 @@
TOPIC("About$en-us")
#include "About$en-us.tpp"
TOPIC("Files$en-us")
#include "Files$en-us.tpp"
END_TOPIC
TOPIC("Sponsor$en-us")
#include "Sponsor$en-us.tpp"
END_TOPIC
TOPIC("Assist$en-us")
#include "Assist$en-us.tpp"
END_TOPIC
TOPIC("Blitz$en-us")
#include "Blitz$en-us.tpp"
TOPIC("install$en-us")
#include "install$en-us.tpp"
END_TOPIC
TOPIC("index$en-us")
#include "index$en-us.tpp"
END_TOPIC
TOPIC("BSD$en-us")
#include "BSD$en-us.tpp"
END_TOPIC
TOPIC("cmdline$en-us")
#include "cmdline$en-us.tpp"
END_TOPIC
TOPIC("ConfiguringPackagesAssemblies$en-us")
#include "ConfiguringPackagesAssemblies$en-us.tpp"
END_TOPIC
TOPIC("Contact$en-us")
#include "Contact$en-us.tpp"
TOPIC("IntroductionToUPP$en-us")
#include "IntroductionToUPP$en-us.tpp"
END_TOPIC
TOPIC("CrossComp$en-gb")
#include "CrossComp$en-gb.tpp"
END_TOPIC
TOPIC("PackageTemplates$en-us")
#include "PackageTemplates$en-us.tpp"
END_TOPIC
TOPIC("About$en-us")
#include "About$en-us.tpp"
END_TOPIC
TOPIC("esc$en-us")
#include "esc$en-us.tpp"
END_TOPIC
TOPIC("Files$en-us")
#include "Files$en-us.tpp"
TOPIC("Keys$en-us")
#include "Keys$en-us.tpp"
END_TOPIC
TOPIC("Flags$en-us")
#include "Flags$en-us.tpp"
TOPIC("cmdline$en-us")
#include "cmdline$en-us.tpp"
END_TOPIC
TOPIC("GettingStarted$en-us")
#include "GettingStarted$en-us.tpp"
TOPIC("Topic$en-us")
#include "Topic$en-us.tpp"
END_TOPIC
TOPIC("NewProject$en-us")
#include "NewProject$en-us.tpp"
END_TOPIC
TOPIC("ConfiguringPackagesAssemblies$en-us")
#include "ConfiguringPackagesAssemblies$en-us.tpp"
END_TOPIC
TOPIC("GPL$en-us")
@ -54,43 +70,27 @@ TOPIC("IconDes$en-us")
#include "IconDes$en-us.tpp"
END_TOPIC
TOPIC("index$en-us")
#include "index$en-us.tpp"
END_TOPIC
TOPIC("install$en-us")
#include "install$en-us.tpp"
END_TOPIC
TOPIC("IntroductionToUPP$en-us")
#include "IntroductionToUPP$en-us.tpp"
END_TOPIC
TOPIC("Keys$en-us")
#include "Keys$en-us.tpp"
TOPIC("Blitz$en-us")
#include "Blitz$en-us.tpp"
END_TOPIC
TOPIC("macros$en-us")
#include "macros$en-us.tpp"
END_TOPIC
TOPIC("NewProject$en-us")
#include "NewProject$en-us.tpp"
END_TOPIC
TOPIC("PackagesAssembliesAndNests$en-us")
#include "PackagesAssembliesAndNests$en-us.tpp"
END_TOPIC
TOPIC("PackageTemplates$en-us")
#include "PackageTemplates$en-us.tpp"
TOPIC("GettingStarted$en-us")
#include "GettingStarted$en-us.tpp"
END_TOPIC
TOPIC("Sponsor$en-us")
#include "Sponsor$en-us.tpp"
TOPIC("Contact$en-us")
#include "Contact$en-us.tpp"
END_TOPIC
TOPIC("Topic$en-us")
#include "Topic$en-us.tpp"
TOPIC("Flags$en-us")
#include "Flags$en-us.tpp"
END_TOPIC

View file

@ -274,7 +274,6 @@ void Ide::SyncUsc()
UscFile(file);
}
}
UscProcessDir(GetCommonDir());
UscProcessDir(GetLocalDir());
UscProcessDir(GetFileFolder(ConfigFile("x")));
}

View file

@ -16,17 +16,15 @@ LAYOUT(ConfigLayout, 724, 214)
ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(4, 80).BottomPosZ(4, 22))
END_LAYOUT
LAYOUT(BaseSetupLayout, 420, 164)
LAYOUT(BaseSetupLayout, 420, 124)
ITEM(Label, dv___0, SetLabel(t_("&Package nests:")).LeftPosZ(4, 190).TopPosZ(4, 15))
ITEM(EditString, upp, LeftPosZ(4, 408).TopPosZ(20, 19))
ITEM(Label, dv___2, SetLabel(t_("&Output and intermediate directory root:")).LeftPosZ(4, 192).TopPosZ(44, 15))
ITEM(EditString, output, LeftPosZ(4, 408).TopPosZ(60, 19))
ITEM(Label, dv___4, SetLabel(t_("&Common files root:")).LeftPosZ(4, 192).TopPosZ(84, 15))
ITEM(EditString, common, LeftPosZ(4, 408).TopPosZ(100, 19))
ITEM(Label, dv___6, SetLabel(t_("&Assembly name:")).LeftPosZ(4, 84).TopPosZ(132, 20))
ITEM(EditString, base, NotNull(true).LeftPosZ(92, 96).TopPosZ(132, 19))
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(272, 64).TopPosZ(132, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(348, 64).TopPosZ(132, 24))
ITEM(Label, dv___4, SetLabel(t_("&Assembly name:")).LeftPosZ(4, 84).TopPosZ(92, 20))
ITEM(EditString, base, NotNull(true).LeftPosZ(92, 96).TopPosZ(92, 19))
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(272, 64).TopPosZ(92, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(348, 64).TopPosZ(92, 24))
END_LAYOUT
LAYOUT(ConfLayout, 344, 120)
@ -412,19 +410,21 @@ LAYOUT(SetupEditorLayout, 488, 280)
ITEM(Option, header_guards, SetLabel(t_("Insert guards to new headers")).LeftPosZ(316, 164).TopPosZ(4, 15))
ITEM(Option, auto_enclose, SetLabel(t_("[ { ( \" / * enclose selection")).LeftPosZ(12, 168).TopPosZ(220, 15))
ITEM(Option, mark_lines, SetLabel(t_("Mark lines with errors, warning and changes")).LeftPosZ(12, 256).TopPosZ(240, 16))
ITEM(Option, showtime, SetLabel(t_("Underline recently changed files")).LeftPosZ(12, 256).TopPosZ(260, 16))
ITEM(Option, showtime, SetLabel(t_("Underline recently changed files after")).LeftPosZ(12, 208).TopPosZ(260, 16))
ITEM(EditDate, showtimeafter, NotNull(true).LeftPosZ(228, 72).TopPosZ(259, 19))
ITEM(Button, today, SetLabel(t_("Today")).LeftPosZ(304, 52).TopPosZ(259, 19))
END_LAYOUT
LAYOUT(SetupIdeLayout, 520, 264)
ITEM(Option, mute_sounds, SetLabel(t_("Mute sounds")).LeftPosZ(8, 80).TopPosZ(8, 18))
ITEM(Option, wrap_console_text, SetLabel(t_("Wrap console text")).LeftPosZ(8, 110).TopPosZ(28, 18))
ITEM(Option, show_status_bar, SetLabel(t_("Show status bar")).LeftPosZ(8, 96).TopPosZ(128, 18))
ITEM(Option, toolbar_in_row, SetLabel(t_("Menu and toolbar in a row")).LeftPosZ(8, 144).TopPosZ(148, 18))
ITEM(Option, splash_screen, SetLabel(t_("Show splash screen")).LeftPosZ(8, 144).TopPosZ(168, 18))
ITEM(Option, assist, SetLabel(t_("Automatic assist")).LeftPosZ(8, 144).TopPosZ(68, 18))
ITEM(Option, mute_sounds, SetLabel(t_("Mute sounds")).LeftPosZ(8, 160).TopPosZ(8, 18))
ITEM(Option, wrap_console_text, SetLabel(t_("Wrap console text")).LeftPosZ(8, 160).TopPosZ(28, 18))
ITEM(Option, show_status_bar, SetLabel(t_("Show status bar")).LeftPosZ(8, 160).TopPosZ(128, 18))
ITEM(Option, toolbar_in_row, SetLabel(t_("Menu and toolbar in a row")).LeftPosZ(8, 160).TopPosZ(148, 18))
ITEM(Option, splash_screen, SetLabel(t_("Show splash screen")).LeftPosZ(8, 160).TopPosZ(168, 18))
ITEM(Option, assist, SetLabel(t_("Automatic assist")).LeftPosZ(8, 160).TopPosZ(68, 18))
ITEM(Option, commentdp, SetLabel(t_("Comment out default parameters when converting declaration to definition instead of removing them")).LeftPosZ(8, 512).TopPosZ(88, 18))
ITEM(Option, browser_clickpos, SetLabel(t_("Browse code on single click")).LeftPosZ(8, 152).TopPosZ(48, 18))
ITEM(Option, browser_closeesc, SetLabel(t_("Esc closes browser")).LeftPosZ(8, 112).TopPosZ(108, 18))
ITEM(Option, browser_clickpos, SetLabel(t_("Browse code on single click")).LeftPosZ(8, 160).TopPosZ(48, 18))
ITEM(Option, browser_closeesc, SetLabel(t_("Esc closes browser")).LeftPosZ(8, 160).TopPosZ(108, 18))
ITEM(Label, dv___9, SetLabel(t_("HYDRA1 threads:")).LeftPosZ(8, 92).TopPosZ(188, 19))
ITEM(EditIntSpin, hydra1_threads, Min(1).Max(10).LeftPosZ(112, 48).TopPosZ(188, 19))
ITEM(Label, dv___11, SetLabel(t_("GUI theme")).LeftPosZ(8, 92).TopPosZ(212, 19))

View file

@ -491,7 +491,7 @@ void Ide::EditFile(const String& p)
}
filelist.KillCursor();
package.KillCursor();
package.SetCursor(package.GetCount() - 1);
package.SetCursor(package.GetCount() - 2);
actual.file.Add(path);
SaveLoadPackage();
ShowFile(package.GetCount() - 1);

View file

@ -104,7 +104,7 @@ void Ide::OpenATopic()
void Ide::DppIgnoreList()
{
EditFile(CommonPath("dppignore.txt"));
EditFile(IgnoreFile());
}
void Ide::InsertColor()
@ -259,7 +259,6 @@ Vector<String> Ide::SvnDirs()
for(int i = 0; i < d.GetCount(); i++)
if(DirectoryExists(AppendFileName(d[i], ".svn")))
r.Add(d[i]);
DUMPC(r);
return r;
}