mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-11 22:03:53 -06:00
ide: Open Terminal in Win32
git-svn-id: svn://ultimatepp.org/upp/trunk@15525 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
a3a306c3cc
commit
6d3e844bf6
10 changed files with 54 additions and 33 deletions
|
|
@ -308,7 +308,7 @@ void Ide::Serialize(Stream& s)
|
|||
String dummy;
|
||||
s % dummy;
|
||||
}
|
||||
s % LinuxHostConsole;
|
||||
s % HostConsole;
|
||||
editor.SerializeNavigator(s);
|
||||
s % showtime;
|
||||
s % DiffFs();
|
||||
|
|
@ -320,6 +320,11 @@ void Ide::Serialize(Stream& s)
|
|||
if(version >= 19) {
|
||||
s % gui_font % gui_font_override;
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
if(s.IsLoading() && HostConsole == "/usr/bin/xterm -e")
|
||||
HostConsole = "powershell.exe";
|
||||
#endif
|
||||
}
|
||||
|
||||
Time Ide::ConfigTime()
|
||||
|
|
|
|||
|
|
@ -195,7 +195,11 @@ void sCleanZombies(int signal_number)
|
|||
}
|
||||
#endif
|
||||
|
||||
String LinuxHostConsole = "/usr/bin/xterm -e";
|
||||
#ifdef PLATFORM_WIN32
|
||||
String HostConsole = "powershell.exe";
|
||||
#else
|
||||
String HostConsole = "/usr/bin/xterm -e";
|
||||
#endif
|
||||
|
||||
void LocalHost::Launch(const char *_cmdline, bool console)
|
||||
{
|
||||
|
|
@ -240,19 +244,19 @@ void LocalHost::Launch(const char *_cmdline, bool console)
|
|||
};
|
||||
int ii = 0;
|
||||
for(;;) { // If (pre)defined terminal emulator is not available, try to find one
|
||||
int c = LinuxHostConsole.FindFirstOf(" ");
|
||||
lc = c < 0 ? LinuxHostConsole : LinuxHostConsole.Left(c);
|
||||
int c = HostConsole.FindFirstOf(" ");
|
||||
lc = c < 0 ? HostConsole : HostConsole.Left(c);
|
||||
if(ii >= __countof(term) || FileExists(lc))
|
||||
break;
|
||||
LinuxHostConsole = term[ii++];
|
||||
HostConsole = term[ii++];
|
||||
}
|
||||
if(FileExists(lc))
|
||||
{
|
||||
if(console)
|
||||
cmdline = LinuxHostConsole + " sh " + script;
|
||||
cmdline = HostConsole + " sh " + script;
|
||||
}
|
||||
else
|
||||
if(LinuxHostConsole.GetCount())
|
||||
if(HostConsole.GetCount())
|
||||
PutConsole("Warning: Terminal '" + lc + "' not found, executing in background.");
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
enum { REMOTE_TIMEOUT = 2000 };
|
||||
|
||||
extern String LinuxHostConsole;
|
||||
extern String HostConsole;
|
||||
|
||||
class Host {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -178,6 +178,13 @@ void Ide::ExecuteBinary()
|
|||
}
|
||||
}
|
||||
|
||||
void Ide::LaunchTerminal(const char *dir)
|
||||
{
|
||||
One<Host> h = CreateHostRunDir();
|
||||
h->ChDir(dir);
|
||||
h->Launch(Nvl(HostConsole, "powershell.exe"), false);
|
||||
}
|
||||
|
||||
class SelectAndroidDeviceDlg : public WithSelectAndroidDeviceLayout<TopWindow> {
|
||||
typedef SelectAndroidDeviceDlg CLASSNAME;
|
||||
|
||||
|
|
|
|||
|
|
@ -392,21 +392,6 @@ void Ide::SetupFormat() {
|
|||
WithSetupAssistLayout<ParentCtrl> assist;
|
||||
WebSearchTab web_search;
|
||||
AStyleSetupDialog ast(this);
|
||||
#ifdef PLATFORM_WIN32
|
||||
ide.console_txt.Hide();
|
||||
ide.console.Hide();
|
||||
ide.kde.Hide();
|
||||
ide.gnome.Hide();
|
||||
ide.xterm.Hide();
|
||||
ide.mate.Hide();
|
||||
ide.lxde.Hide();
|
||||
#endif
|
||||
ide.kde <<= callback2(SetConsole, &ide.console, "/usr/bin/konsole -e");
|
||||
ide.gnome <<= callback2(SetConsole, &ide.console, "/usr/bin/gnome-terminal -x");
|
||||
ide.mate <<= callback2(SetConsole, &ide.console, "/usr/bin/mate-terminal -x");
|
||||
ide.lxde <<= callback2(SetConsole, &ide.console, "/usr/bin/lxterminal -e");
|
||||
ide.xterm <<= callback2(SetConsole, &ide.console, "/usr/bin/xterm -e");
|
||||
|
||||
edt.lineends
|
||||
.Add(LF, "LF")
|
||||
.Add(CRLF, "CRLF")
|
||||
|
|
@ -434,6 +419,22 @@ void Ide::SetupFormat() {
|
|||
dlg.Add(web_search, "Web search");
|
||||
dlg.WhenClose = dlg.Acceptor(IDEXIT);
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
ide.xterm.SetLabel("powershell");
|
||||
ide.xterm << [&] { ide.console <<= "powershell.exe"; };
|
||||
ide.gnome.SetLabel("cmd");
|
||||
ide.gnome << [&] { ide.console <<= "cmd.exe"; };
|
||||
ide.kde.Hide();
|
||||
ide.mate.Hide();
|
||||
ide.lxde.Hide();
|
||||
#else
|
||||
ide.kde <<= callback2(SetConsole, &ide.console, "/usr/bin/konsole -e");
|
||||
ide.gnome <<= callback2(SetConsole, &ide.console, "/usr/bin/gnome-terminal -x");
|
||||
ide.mate <<= callback2(SetConsole, &ide.console, "/usr/bin/mate-terminal -x");
|
||||
ide.lxde <<= callback2(SetConsole, &ide.console, "/usr/bin/lxterminal -e");
|
||||
ide.xterm <<= callback2(SetConsole, &ide.console, "/usr/bin/xterm -e");
|
||||
#endif
|
||||
|
||||
FontSelectManager ed, vf, con, f1, f2, tf, gui;
|
||||
ed.Set(fnt.face, fnt.height, fnt.bold, fnt.italic);
|
||||
vf.Set(fnt.vface, fnt.vheight, fnt.vbold, fnt.vitalic);
|
||||
|
|
@ -518,7 +519,7 @@ void Ide::SetupFormat() {
|
|||
(ide.wrap_console_text, wrap_console_text)
|
||||
(ide.hydra1_threads, hydra1_threads)
|
||||
(ide.chstyle, chstyle)
|
||||
(ide.console, LinuxHostConsole)
|
||||
(ide.console, HostConsole)
|
||||
(ide.output_per_assembly, output_per_assembly)
|
||||
(ide.setmain_newide, setmain_newide)
|
||||
(ide.gui_font, gui_font_override)
|
||||
|
|
|
|||
|
|
@ -312,6 +312,7 @@ struct WorkspaceWork {
|
|||
virtual void FileRename(const String& nm) {}
|
||||
virtual bool FileRemove() { return true; }
|
||||
virtual void SyncSvnDir(const String& working) {}
|
||||
virtual void LaunchTerminal(const char *dir) {}
|
||||
|
||||
void ScanWorkspace();
|
||||
void SavePackage();
|
||||
|
|
|
|||
|
|
@ -885,6 +885,7 @@ void WorkspaceWork::FileMenu(Bar& menu)
|
|||
menu.Separator();
|
||||
menu.Add("Open File Directory",THISBACK(OpenFileFolder));
|
||||
menu.Add("Copy File Path", callback1(WriteClipboardText, GetActiveFilePath()));
|
||||
menu.Add("Terminal at File Directory", [=] { LaunchTerminal(GetFileDirectory(GetActiveFilePath())); });
|
||||
menu.Separator();
|
||||
menu.Add(filelist.GetCursor() > 0, "Move up", THISBACK1(MoveFile, -1))
|
||||
.Key(organizer ? K_CTRL_UP : K_SHIFT_CTRL_UP)
|
||||
|
|
@ -1059,6 +1060,7 @@ void WorkspaceWork::PackageMenu(Bar& menu)
|
|||
menu.Separator();
|
||||
BuildPackageMenu(menu);
|
||||
menu.Add("Open Package Directory",THISBACK(OpenPackageFolder));
|
||||
menu.Add("Terminal at Package Directory", [=] { LaunchTerminal(GetFileDirectory(GetActivePackagePath())); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1022,6 +1022,8 @@ public:
|
|||
String GetTargetLogPath();
|
||||
String GetIdeLogPath();
|
||||
void OpenLog(const String& logFilePath);
|
||||
|
||||
virtual void LaunchTerminal(const char *dir);
|
||||
|
||||
// Console& GetConsole();
|
||||
|
||||
|
|
|
|||
|
|
@ -606,13 +606,13 @@ LAYOUT(SetupIdeLayout, 512, 336)
|
|||
ITEM(Upp::Option, bold, SetLabel(t_("Bold")).LeftPosZ(322, 44).TopPosZ(192, 19))
|
||||
ITEM(Upp::Option, italic, SetLabel(t_("Italic")).LeftPosZ(370, 44).TopPosZ(192, 19))
|
||||
ITEM(Upp::Label, dv___19, SetLabel(t_("(needs restart)")).LeftPosZ(416, 88).TopPosZ(192, 19))
|
||||
ITEM(Upp::Label, console_txt, SetLabel(t_("Use console in Linux")).LeftPosZ(4, 112).TopPosZ(216, 19))
|
||||
ITEM(Upp::EditString, console, LeftPosZ(120, 296).TopPosZ(216, 19))
|
||||
ITEM(Upp::Button, xterm, SetLabel(t_("xterm")).LeftPosZ(120, 56).TopPosZ(240, 20))
|
||||
ITEM(Upp::Button, gnome, SetLabel(t_("Gnome")).LeftPosZ(180, 56).TopPosZ(240, 20))
|
||||
ITEM(Upp::Button, kde, SetLabel(t_("KDE")).LeftPosZ(240, 56).TopPosZ(240, 20))
|
||||
ITEM(Upp::Button, mate, SetLabel(t_("Mate")).LeftPosZ(300, 56).TopPosZ(240, 20))
|
||||
ITEM(Upp::Button, lxde, SetLabel(t_("LXDE")).LeftPosZ(360, 56).TopPosZ(240, 20))
|
||||
ITEM(Upp::Label, console_txt, SetLabel(t_("Console binary")).LeftPosZ(4, 112).TopPosZ(216, 19))
|
||||
ITEM(Upp::EditString, console, LeftPosZ(120, 376).TopPosZ(216, 19))
|
||||
ITEM(Upp::Button, xterm, SetLabel(t_("xterm")).LeftPosZ(120, 72).TopPosZ(240, 20))
|
||||
ITEM(Upp::Button, gnome, SetLabel(t_("Gnome")).LeftPosZ(196, 72).TopPosZ(240, 20))
|
||||
ITEM(Upp::Button, kde, SetLabel(t_("KDE")).LeftPosZ(272, 72).TopPosZ(240, 20))
|
||||
ITEM(Upp::Button, mate, SetLabel(t_("Mate")).LeftPosZ(348, 72).TopPosZ(240, 20))
|
||||
ITEM(Upp::Button, lxde, SetLabel(t_("LXDE")).LeftPosZ(424, 72).TopPosZ(240, 20))
|
||||
ITEM(Upp::Option, output_per_assembly, SetLabel(t_("Use unique output directory per assembly (append assembly name to output directory)")).HSizePosZ(4, 4).TopPosZ(268, 16))
|
||||
ITEM(Upp::Label, dv___28, SetLabel(t_("In editor mode, path for .usc files")).LeftPosZ(4, 192).TopPosZ(288, 20))
|
||||
ITEM(Upp::EditString, uscpath, HSizePosZ(172, 28).TopPosZ(288, 19))
|
||||
|
|
|
|||
|
|
@ -680,10 +680,9 @@ void Ide::BuildMenu(Bar& menu)
|
|||
.Help("Find next " + hh + "according to console pane");
|
||||
menu.Add(ffb, AK_FINDPREVERROR, THISBACK(FindPrevError))
|
||||
.Help("Find previous " + hh + "according to console pane");
|
||||
#if defined(PLATFORM_WIN32) || defined(PLATFORM_POSIX)
|
||||
menu.MenuSeparator();
|
||||
menu.Add(!IsNull(target), AK_OPENOUTDIR, THISBACK(OpenOutputFolder));
|
||||
#endif
|
||||
menu.Add(!IsNull(target), "Terminal at output directory", [=] { LaunchTerminal(GetFileFolder(target)); });
|
||||
}
|
||||
|
||||
void Ide::DebugMenu(Bar& menu)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue