public void OpenFilesInNewWindow(string[] paths) { NotepadWindow window = CreateNotepadWindowAndOpenFiles(paths); AddWindow(window); ShowWindow(window); }
/// <summary> /// Create a completely blank Notepad window with no notepad items /// </summary> /// <returns></returns> public NotepadWindow CreateBlankNotepadWindow() { NotepadWindow window = new NotepadWindow(); SetupNotepadWindow(window, false, false); return(window); }
/// <summary> /// Creates and shows a Notepad Window using the given view model. /// </summary> /// <param name="notepad"></param> public void CreateAndShowWindowFromViewModel(NotepadViewModel notepad) { notepad.SetupInformationHook(); NotepadWindow window = CreateWindowFromViewModel(notepad); AddNewNotepadAndPreviewWindowFromWindow(window); }
/// <summary> /// (ONLY USE WHEN STARTING APPLICATION) Creates a Notepad window and adds an item. /// Loads the theme and preferences by default, meaning if you create this window but changed /// the theme before this will change it back. Only use when starting up appplication. /// </summary> /// <param name="loadAndSetAppTheme"></param> /// <param name="loadGlobalPreferencesG"></param> /// <returns></returns> public NotepadWindow CreateApplicationStartupNotepadWindow(bool loadAndSetAppTheme = true, bool loadGlobalPreferencesG = true) { NotepadWindow window = new NotepadWindow(NewWinPrefs.OpenDefaultNotepadAfterLaunch); SetupNotepadWindow(window, loadAndSetAppTheme, loadGlobalPreferencesG); return(window); }
/// <summary> /// Sets up a Notepad window's callbacks (focusing, closed, etc) /// </summary> /// <param name="window"></param> public void SetupNotepadWindowCallbacksAndProperties(NotepadWindow window) { window.WindowFocusedCallback = OnWindowFocused; window.WindowShownCallback = OnWindowShown; window.WindowClosedCallback = OnWindowClosed; window.Notepad.View = window; }
/// <summary> /// (ONLY USE WHEN STARTING APPLICATION) Creates and shows a Notepad window which loads the theme/ /// perferences, and opens the files' paths given in the parameters. Also opens the previously unclosed files /// </summary> /// <param name="args"></param> public void CreateAndShowApplicationStartupNotepadWindowAndPreviewAndOpenUnclosedFiles(string[] args) { NotepadWindow window = CreateNotepadWindowAndOpenFiles(args, true, true, useStartupDelay: true); WindowPreviewControlViewModel wpc = CreatePreviewControlFromDataContext(window.Notepad); AddPreviewItem(wpc); AddWindow(window); ShowWindow(window); if (PreferencesG.SAVE_OPEN_UNCLOSED_FILES) { try { List <string> filesToOpen = ThisApplication.GetPreviouslyUnclosedFiles(); foreach (string file in filesToOpen) { window.Notepad.OpenNotepadFromPath(file); } } catch { } finally { ThisApplication.DeletePreviouslyUnclosedFiles(); } } }
public void OnWindowFocused(NotepadWindow window) { if (window != null) { WindowManager.FocusedWindow = window; } }
/// <summary> /// Create Notepad window with a default item /// </summary> /// <returns></returns> public NotepadWindow CreateNotepadWindowWithItem() { NotepadWindow window = new NotepadWindow(); window.AddStartupNotepad(); SetupNotepadWindow(window); return(window); }
/// <summary> /// Creates a Notepad window using the given view model as it's DataContext /// </summary> /// <param name="notepad"></param> /// <returns></returns> public NotepadWindow CreateWindowFromViewModel(NotepadViewModel notepad) { NotepadWindow window = new NotepadWindow(); window.Notepad = notepad; SetupNotepadWindow(window); return(window); }
/// <summary> /// Adds and shows a given Notepad window /// </summary> /// <param name="window"></param> public void AddNewNotepadAndPreviewWindowFromWindow(NotepadWindow window) { WindowPreviewControlViewModel wpc = CreatePreviewControlFromDataContext(window.Notepad); AddPreviewItem(wpc); SetupNotepadWindowCallbacksAndProperties(window); AddWindow(window); ShowWindow(window); }
/// <summary> /// Creates and shows a Notepad window with no items. Loads /// them theme and preferences. /// </summary> public void CreateAndShowNotepadWindowAndPreviewWithDefaultItem() { NotepadWindow window = CreateNotepadWindowWithItem(); WindowPreviewControlViewModel wpc = CreatePreviewControlFromDataContext(window.Notepad); AddPreviewItem(wpc); AddWindow(window); ShowWindow(window); }
/// <summary> /// (ONLY USE WHEN STARTING APPLICATION) Creates and shows a Notepad window which loads the theme/ /// perferences, and opens the files' paths given in the parameters /// </summary> /// <param name="args"></param> public void CreateAndShowApplicationStartupNotepadWindowAndPreview(string[] args) { NotepadWindow window = CreateNotepadWindowAndOpenFiles(args, true, true); WindowPreviewControlViewModel wpc = CreatePreviewControlFromDataContext(window.Notepad); AddPreviewItem(wpc); AddWindow(window); ShowWindow(window); }
/// <summary> /// (ONLY USE WHEN STARTING APPLICATION) Creates and shows a startup Notepad window. /// </summary> public void CreateAndShowStartupNotepadWindowAndPreview() { NotepadWindow window = CreateApplicationStartupNotepadWindow(); WindowPreviewControlViewModel wpc = CreatePreviewControlFromDataContext(window.Notepad); AddPreviewItem(wpc); AddWindow(window); ShowWindow(window); }
public void FocusWindowFromDataContext(NotepadViewModel notepad) { NotepadWindow win = WindowManager.GetNotepadWindowFromNotepad(notepad); if (win != null) { win.Focus(); } }
public void RemoveWindowAndPreviewFromWindow(NotepadWindow window) { RemoveWindow(window); WindowPreviewControlViewModel wpc = GetPreviewControlFromNotepad(window.Notepad); if (wpc != null) { RemovePreviewItem(wpc); } }
public void CloseWindowAndRemovePreviewFromPreview(WindowPreviewControlViewModel wpcvm) { RemovePreviewItem(wpcvm); NotepadWindow nw = WindowManager.GetNotepadWindowFromNotepad(wpcvm.Notepad); if (nw != null) { CloseWindow(nw); } }
/// <summary> /// Create a Notepad window and open multiple files /// </summary> /// <param name="fileNames"></param> /// <param name="loadAndSetAppTheme"></param> /// <param name="loadWindowPosition"></param> /// <param name="clearPath">States whether the paths of the items should be cleared</param> /// <param name="useStartupDelay"></param> /// <returns></returns> public NotepadWindow CreateNotepadWindowAndOpenFiles( string[] fileNames, bool loadAndSetAppTheme = false, bool loadWindowPosition = false, bool clearPath = false, bool useStartupDelay = false) { NotepadWindow window = new NotepadWindow(fileNames, clearPath: clearPath, useStartupDelay: useStartupDelay); SetupNotepadWindow(window, loadAndSetAppTheme, loadWindowPosition); return(window); }
public static void SaveAllUnclosedFilesToStorageLocation(NotepadWindow window) { NotepadViewModel model = window.Notepad; foreach (NotepadItemViewModel item in model.NotepadItems) { TextDocumentViewModel doc = item.Notepad; if (!doc.Document.Text.IsEmpty() && doc.HasMadeChanges) { if (CheckUnclosedStorageDirectoryExistsElseCreateIt()) { WriteFileToUnclosedStorageLocation(doc.Document.FileName, doc.Document.Text); } } } }
public void OnWindowClosed(NotepadWindow window) { window?.Notepad?.Shutdown(); RemoveWindowAndPreviewFromWindow(window); int windowsCount = WindowManager.NotepadWindows.Count; if (windowsCount > 0) { History.PushNotepad(window.Notepad); WindowManager.NotepadWindows[windowsCount - 1]?.Focus(); } else { ThisApplication.ShutdownApplication(); } }
/* protected override void Run() * { * Font f = new BasicFont(); * FontRenderer fr = new FontRenderer(display, f, 63); * FontRenderer dfr = new FontRenderer(display, f, 0); * * IconPack ip = new BasicIconPack(); * IconRenderer ir = new IconRenderer(display, ip); * * startMenu = false; * held = false; * * second = time.Second(); * while (true) * { * WindowManager.handleMouse(mouse); * handleMouse(mouse); * draw(fr, dfr, startMenu, ir); * WindowManager.drawWindows(display, ir, dfr); * mr.renderMouse(); * display.step(); * } */ public void handleMouse(MouseDriver mouse) { if (mouse.LeftClickState()) { if (held == false) { if (mouse.X() > 0 && mouse.X() < 120 && mouse.Y() > 0 && mouse.Y() < 15) { startMenu = !startMenu; } else if (startMenu && mouse.X() > 0 && mouse.X() < 120 && mouse.Y() > 15 && mouse.Y() < 155) { if (mouse.X() > 25 && mouse.X() < 110 && mouse.Y() > 80 && mouse.Y() < 95) { Sys.Power.Reboot(); } } else { if (mouse.X() > 85 && mouse.X() < 105 && mouse.Y() > 15 && mouse.Y() < 25) { NotepadWindow.reset(); } if (startMenu == true) { startMenu = false; } } held = true; } } else { held = false; } }
public static void handleMouse(MouseDriver mouse) { NotepadWindow.handleMouse(mouse); }
public static void drawWindows(BufferedDisplayDriver display, IconRenderer ir, FontRenderer fr) { NotepadWindow.renderWindow(display, ir, fr); }
/// <summary> /// Sets up a Notepad window's callbacks /// the preferencesG by default. /// </summary> /// <param name="window"></param> /// <param name="loadAndSetAppTheme"></param> /// <param name="loadGlobalPreferenesG"></param> public void SetupNotepadWindow(NotepadWindow window, bool loadAndSetAppTheme = false, bool loadGlobalPreferenesG = true) { SetupNotepadWindowCallbacksAndProperties(window); window.LoadSettings(loadAndSetAppTheme, loadGlobalPreferenesG); window.CanSavePreferences = true; }
//rivate void TheRMutex_OnMessageReceived(ApplicationMessage messageType, string message) // // if (messageType == ApplicationMessage.OpenFiles) // { // WindowManager.FocusedWindow.Notepad.OpenNotepadFromPath(message, true, false, false); // } // public void OpenFileInNewWindow(string path, bool clearPath = false, bool useStartupDelay = false) { NotepadWindow window = CreateNotepadWindowAndOpenFiles(new string[] { path }, clearPath: clearPath, useStartupDelay: useStartupDelay); AddNewNotepadAndPreviewWindowFromWindow(window); }
public void OnWindowShown(NotepadWindow window) { // not really used }
public void AddWindow(NotepadWindow window) { WindowManager.NotepadWindows.Add(window); }
public void CloseWindow(NotepadWindow window) { window.Close(); }
public void ShowWindow(NotepadWindow window) { window.Show(); }
public void RemoveWindow(NotepadWindow window) { WindowManager.NotepadWindows.Remove(window); }