* Changed Set/Get HilateCap to Set/Get HighlightCap

* Changes ReadText in CEdit to fix problem with SatCom links
* Filenames when loading/saving scripts should be fixed on mxe
dev-ui
erihel 2013-03-20 21:50:44 +01:00
parent 64be7a5df6
commit 1406464f0c
6 changed files with 25 additions and 17 deletions

View File

@ -1186,7 +1186,7 @@ void CRobotMain::ChangePhase(Phase phase)
pe->SetGenericMode(true); pe->SetGenericMode(true);
pe->SetFontType(Gfx::FONT_COLOBOT); pe->SetFontType(Gfx::FONT_COLOBOT);
pe->SetEditCap(false); pe->SetEditCap(false);
pe->SetHiliteCap(false); pe->SetHighlightCap(false);
pe->ReadText(std::string("help/win.txt")); pe->ReadText(std::string("help/win.txt"));
} }
else else

View File

@ -381,7 +381,7 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc
edit->ReadText(filename.c_str()); edit->ReadText(filename.c_str());
edit->HyperHome(filename.c_str()); edit->HyperHome(filename.c_str());
edit->SetEditCap(false); // just to see! edit->SetEditCap(false); // just to see!
edit->SetHiliteCap(false); edit->SetHighlightCap(false);
edit->SetFocus(true); edit->SetFocus(true);
ViewDisplayInfo(); ViewDisplayInfo();
@ -785,7 +785,7 @@ void CDisplayInfo::UpdateIndexButton()
if ( edit != 0 ) if ( edit != 0 )
{ {
//? edit->SetHiliteCap(m_index==SATCOM_LOADING); //? edit->SetHiliteCap(m_index==SATCOM_LOADING);
edit->SetHiliteCap(true); edit->SetHighlightCap(true);
} }
UpdateCopyButton(); UpdateCopyButton();

View File

@ -786,8 +786,7 @@ void CEdit::HyperJump(std::string name, std::string marker)
if ( name[0] == '%' ) { if ( name[0] == '%' ) {
filename = GetProfile().GetUserBasedPath(name, "") + ".txt"; filename = GetProfile().GetUserBasedPath(name, "") + ".txt";
} else { } else {
std::string path = CApplication::GetInstancePointer()->GetDataDirPath() + "/help/" + name + ".txt"; filename = "/help/" + name + ".txt";
filename = fs::path(path).generic_string();
} }
if ( ReadText(filename) ) if ( ReadText(filename) )
@ -1449,7 +1448,16 @@ bool CEdit::ReadText(std::string filename, int addSize)
bool bInSoluce, bBOL; bool bInSoluce, bBOL;
if ( filename[0] == 0 ) return false; if ( filename[0] == 0 ) return false;
file = fopen(filename.c_str(), "rb"); boost::replace_all(filename, "\\", "/");
/* This is ugly but doesn't require many changes in code. If file doesn't
exists it's posible filename is absolute not full path */
std::string path = filename;
if (!fs::exists(path)) {
path = CApplication::GetInstancePointer()->GetDataDirPath() + "/" + filename;
}
file = fopen(fs::path(path).make_preferred().string().c_str(), "rb");
if ( file == NULL ) return false; if ( file == NULL ) return false;
fseek(file, 0, SEEK_END); fseek(file, 0, SEEK_END);
@ -1974,12 +1982,12 @@ bool CEdit::GetEditCap()
// Mode management "hilitable" (that's the franch). // Mode management "hilitable" (that's the franch).
void CEdit::SetHiliteCap(bool bEnable) void CEdit::SetHighlightCap(bool bEnable)
{ {
m_bHilite = bEnable; m_bHilite = bEnable;
} }
bool CEdit::GetHiliteCap() bool CEdit::GetHighlightCap()
{ {
return m_bHilite; return m_bHilite;
} }

View File

@ -155,8 +155,8 @@ public:
void SetEditCap(bool bMode); void SetEditCap(bool bMode);
bool GetEditCap(); bool GetEditCap();
void SetHiliteCap(bool bEnable); void SetHighlightCap(bool bEnable);
bool GetHiliteCap(); bool GetHighlightCap();
void SetInsideScroll(bool bInside); void SetInsideScroll(bool bInside);
bool GetInsideScroll(); bool GetInsideScroll();

View File

@ -891,7 +891,7 @@ pb->SetState(STATE_SHADOW);
pe->SetState(STATE_SHADOW); pe->SetState(STATE_SHADOW);
pe->SetMaxChar(500); pe->SetMaxChar(500);
pe->SetEditCap(false); // just to see pe->SetEditCap(false); // just to see
pe->SetHiliteCap(false); pe->SetHighlightCap(false);
// Button displays the "soluce": // Button displays the "soluce":
if ( m_phase != PHASE_TRAINER && if ( m_phase != PHASE_TRAINER &&
@ -1815,7 +1815,7 @@ pos.y -= 0.048f;
pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1); pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
pe->SetGenericMode(true); pe->SetGenericMode(true);
pe->SetEditCap(false); pe->SetEditCap(false);
pe->SetHiliteCap(false); pe->SetHighlightCap(false);
pe->SetFontType(Gfx::FONT_COURIER); pe->SetFontType(Gfx::FONT_COURIER);
pe->SetFontSize(8.0f); pe->SetFontSize(8.0f);
pe->ReadText("help/authors.txt"); pe->ReadText("help/authors.txt");
@ -1827,7 +1827,7 @@ pos.y -= 0.048f;
pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT2); pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT2);
pe->SetGenericMode(true); pe->SetGenericMode(true);
pe->SetEditCap(false); pe->SetEditCap(false);
pe->SetHiliteCap(false); pe->SetHighlightCap(false);
pe->SetFontType(Gfx::FONT_COURIER); pe->SetFontType(Gfx::FONT_COURIER);
pe->SetFontSize(6.5f); pe->SetFontSize(6.5f);
pe->ReadText("help/licences.txt"); pe->ReadText("help/licences.txt");
@ -1847,7 +1847,7 @@ ddim.y = 150.0f/480.0f;
pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1); pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
pe->SetGenericMode(true); pe->SetGenericMode(true);
pe->SetEditCap(false); pe->SetEditCap(false);
pe->SetHiliteCap(false); pe->SetHighlightCap(false);
pe->SetFontType(Gfx::FONT_COURIER); pe->SetFontType(Gfx::FONT_COURIER);
pe->SetFontSize(8.0f); pe->SetFontSize(8.0f);
pe->ReadText("help/authors.txt"); pe->ReadText("help/authors.txt");

View File

@ -990,13 +990,13 @@ void CStudio::UpdateButtons()
{ {
edit->SetIcon(1); // red background edit->SetIcon(1); // red background
edit->SetEditCap(false); // just to see edit->SetEditCap(false); // just to see
edit->SetHiliteCap(true); edit->SetHighlightCap(true);
} }
else else
{ {
edit->SetIcon(0); // standard background edit->SetIcon(0); // standard background
edit->SetEditCap(true); edit->SetEditCap(true);
edit->SetHiliteCap(true); edit->SetHighlightCap(true);
} }
button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_COMPILE)); button = static_cast< CButton* >(pw->SearchControl(EVENT_STUDIO_COMPILE));
@ -1525,7 +1525,7 @@ void CStudio::UpdateDialogList()
for( fs::directory_iterator file(path); file != end_iter; file++) { for( fs::directory_iterator file(path); file != end_iter; file++) {
if (fs::is_regular_file(file->status()) ) { if (fs::is_regular_file(file->status()) ) {
TimeToAscii(fs::last_write_time(file->path()), time); TimeToAscii(fs::last_write_time(file->path()), time);
sprintf(temp, "%s\t%lu \t%s", file->path().filename().c_str(), fs::file_size(file->path()), time); sprintf(temp, "%s\t%lu \t%s", file->path().filename().string().c_str(), fs::file_size(file->path()), time);
pl->SetName(i++, temp); pl->SetName(i++, temp);
} }