Refactoring comments and README. No further changes

This commit is contained in:
Olaf Schulz 2018-12-18 20:43:23 +01:00
parent 329d621bf8
commit be7e5cf7e1
3 changed files with 35 additions and 30 deletions

View File

@ -20,7 +20,8 @@ Kompilation & Installation
Das Programm benötigt einen Kompiler der Programmiersprache Vala (mind. Version 0.24)
und die Developer-Pakete einiger Bibliotheken. Die Abhängigkeiten können unter Ubuntu
mit dem folgenden Befehl nachinstalliert werden, sofern sie nicht bereits vorhanden sind (Stand: Ubuntu 16.04, November 2017). Bei anderen Distributionen muss der Befehl ggf. angepasst werden.
mit dem folgenden Befehl nachinstalliert werden, sofern sie nicht bereits vorhanden sind
(Stand: Ubuntu 16.04, November 2017). Bei anderen Distributionen muss der Befehl ggf. angepasst werden.
sudo apt-get install valac libgee-0.8-dev libgtk-3-dev libx11-dev libunique-3.0-dev libappindicator3-dev
@ -41,7 +42,7 @@ Hinweise
In der Konfigurationsdatei können unter anderem folgende Einstellungen vorgenommen
werden:
- Breite des Fensters. Mit „width“ können Sie die exakte Breite einstellen und mit
„max_width“ und „min_width“ die relative Breite in Bezug auf die derzeitge Auflösung.
„max_width“ und „min_width“ die relative Breite in Bezug auf die derzeitige Auflösung.
- Anzeige des Numblocks und der Funktionstasten.
- Tastenkürzel für Anzeige und Bewegung des Fensters. Möchten Sie die Tasten-
kombination nicht nutzen, löschen Sie den Text hinter dem Gleichheitszeichen.
@ -51,6 +52,10 @@ Hinweise
Der Wert X∈{1,…,9} ist entsprechend der Position auf dem Numblocks zu interpretieren.
Beim Druck der Tastenkombination springt das Fenster von Position X zu position_cycle[X].
• Das Programm kann auch als virtuelle Tastatur genutzt werden. Damit die Eingabe das
richtige Fenster erreicht muss in der Konfigurationsdatei „window_selectable = 0“
eingetragen werden.
• Das Programm zeigt unter Gnome 3.x in der Indicator-Leiste ein Symbol an. Unter Gnome 2.x
war für diese Funktion noch eine andere Bibliothek verantwortlich. Sie können im
Makefile zwischen den beiden Varianten wechseln, indem Sie die Variable ICON anpassen.

View File

@ -5,18 +5,15 @@ namespace NeoLayoutViewer {
public Gee.Map<string,string> config;
private Gee.Map<string,string> description; // allow optional commenting config entrys.
public string used_config_path;
public string used_config_path;
public ConfigManager(string[] paths, string conffile) {
this.config = new Gee.TreeMap<string, string>();
this.description = new Gee.TreeMap<string, string>();
//add defaults values, if key not set in the config file
//add default values, if key not set in the config file
add_defaults();
//no, it's better to create the conffile in the current dir.
//var conffile2 = @"$(path)$(conffile)";
//try to read/create config file on given array of paths
string conffile2 = null;
@ -31,20 +28,20 @@ namespace NeoLayoutViewer {
}
}
//2. Try deprecated name with leading dot.
if( conffile2 == null ){
foreach( var path in paths ){
string testfile = @"$(path)/.$(conffile)";
debug(@"Search $(testfile)\n");
if( search_config_file(testfile) ){
conffile2 = testfile;
debug(@"Found $(testfile)\n");
break;
}
}
}
//2. Try deprecated name with leading dot
if( conffile2 == null ){
foreach( var path in paths ){
string testfile = @"$(path)/.$(conffile)";
debug(@"Search $(testfile)\n");
if( search_config_file(testfile) ){
conffile2 = testfile;
debug(@"Found $(testfile)\n");
break;
}
}
}
//3. Try to write new conf file if read fails
//3. Try to write new conf file if read had failed
if( conffile2 == null ){
foreach( var path in paths ){
string testfile = @"$(path)/$(conffile)";
@ -62,7 +59,7 @@ namespace NeoLayoutViewer {
load_config_file(conffile2);
add_intern_values();
used_config_path = conffile2;
used_config_path = conffile2;
}
public Gee.Map<string, string> getConfig() {
@ -78,17 +75,19 @@ namespace NeoLayoutViewer {
}
/*
Standard values. This vaules will be written in the config file if
config file was not found.
Standard values. This vaules will be written in the config file
if it was not found.
*/
public void add_defaults(){
//config.set("show_shortcut","<Mod4><Super_L>n", "Toggle the visibility of the window.");
addSetting("show_shortcut","<Ctrl><Alt>q", "Toggle the visibility of the window.");
addSetting("on_top","1", "Show window on top.");
addSetting("position","3", "Window position on startup (num pad orientation)");
addSetting("width","1000","Width in Pixel. Min_width and max_width bound sensible values. ");//Skalierung, sofern wert zwischen width(resolution)*max_width und width(resolution)*min_width
addSetting("min_width","0.25", "Minimal width. 1=full screen width");//Relativ zur Auflösung
addSetting("max_width","0.5", "Maximal width. 1=full screen width");//Relativ zur Auflösung
/* width of application window
if value between 'resolution width'*max_width and 'resolution width'*min_width */
addSetting("width","1000","Width in Pixel. Min_width and max_width bound sensible values. ");
addSetting("min_width","0.25", "Minimal width. 1=full screen width");
addSetting("max_width","0.5", "Maximal width. 1=full screen width");
addSetting("move_shortcut","<Ctrl><Alt>n", "Circle through window posisitions.");
addSetting("position_cycle","2 3 6 1 3 9 4 7 8", "List of positions (num pad orientation)\n# The n-th number marks the next position of the window.\n# To limit the used positions to screen corners use\n#position_cycle = 3 3 9 1 3 9 1 7 7");
addSetting("display_numpad","1", null);
@ -102,8 +101,9 @@ namespace NeoLayoutViewer {
}
/*
Einstellungen, die der Übersicht halber nicht in der Konfigurationsdatei stehen.
*/
Enrich setting map by some values. User can not change them because
intern values overrides external values.
*/
private void add_intern_values() {
config.set("numpad_width","350");
config.set("function_keys_height","30");

View File

@ -115,8 +115,8 @@ Tastenkombinationen:
Bewegen - %s
Beenden (sofern Fenster selektiert) - q
Verwendete Konfigurationsdatei: %s
""".printf(
Verwendete Konfigurationsdatei:\n
%s""".printf(
neo_win.config.get("show_shortcut"),
neo_win.config.get("move_shortcut"),
configm.used_config_path)