Skip to content
This repository has been archived by the owner on Sep 11, 2021. It is now read-only.

Implemented mouse wheel handling and fixed click handling #22

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f993e2f
src/classes/presentation_controller.vala
mikerofone Jan 30, 2011
a443471
src/classes/presentation_controller.vala
mikerofone Jan 30, 2011
d3a7981
Implemented coutdown timer to start of presentation
jakobwesthoff Mar 11, 2011
5886db8
Implemented the countdown timer in a same way. No more hacks ;)
jakobwesthoff Mar 11, 2011
be6d58d
Added method for going back 10 slides
Nov 18, 2011
ccfbba1
Implemented the "go back 10 slides" on backspace
Nov 18, 2011
d613d75
Implemented jump10 calls
Nov 22, 2011
7f90e99
Fine tuning of jump and back for border cases
Nov 22, 2011
926b3df
Small optimization moving two function calls
Nov 22, 2011
77fdfc1
Added p as key to go back 10 slides
Nov 22, 2011
8f9a742
Adapted to poppler >= 0.17
Nov 23, 2011
f522b54
Updated the README with the new keybindings for 10 slides jumps
Nov 23, 2011
ae283a5
Added a text view for displaying notes
Dec 9, 2011
daf66ee
Reading of notes from external file
Dec 10, 2011
1294929
Added .gitignore
Dec 10, 2011
626a68a
Next view "disappears" on last slide
Dec 12, 2011
726715c
Added an option for having a black slide at the end of the presentation
Dec 12, 2011
e8464f7
Added a switch for single monitor presentation
Dec 14, 2011
e93445a
Merge branch 'master' into blackOnEnd
Dec 14, 2011
b4dccd9
Removed warnings when displaying black slide at end
Dec 14, 2011
b7b50e2
Fading to black enabled, but going out not yet
Dec 14, 2011
d573c15
Going in and out of fade_to_black
Dec 14, 2011
72879f4
Fade to black is also shown in the presenter window
Dec 14, 2011
f17d324
First steps towards note editing
Dec 15, 2011
cfc5f04
Merge branch 'notes', remote-tracking branch 'origin/notes' into notes
Dec 16, 2011
3f96b9c
Moved ignoring of key (& mouse) events to the presentation_controller
Dec 16, 2011
eec0664
Note saving supported
Dec 16, 2011
3952c9a
Changed the slide id for notes
Dec 16, 2011
2f74579
Trying to circumvent the issue with endlines at the end of file
Dec 16, 2011
1d63446
Merge branch 'notes'
Dec 16, 2011
399799d
Updated README
Dec 16, 2011
0bca8bf
Added a grab_focus when editing notes
Dec 16, 2011
5d6193a
Added possibility to jump to a slide by number
Dec 16, 2011
f1cb6b7
Merge branch 'gotoPage'
Dec 16, 2011
455c15a
Added a null-resetting for avoiding segfaults at end of presentation
Jan 13, 2012
ccef269
Merge git://github.com/davvil/Pdf-Presenter-Console
mikerofone Jan 28, 2012
f5ab9af
Changed README to include mouse wheel commands
mikerofone Jan 28, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Note saving supported
Note: I think there is a bug in vala/glib/whatever and it always adds a
new line at the end of the notes file. Probably is not critical, but
after many edits you should check your notes file!
  • Loading branch information
David Vilar committed Dec 16, 2011
commit eec0664d84c412a5650b39585f4283e4e8e17d8f
11 changes: 10 additions & 1 deletion src/classes/presentation_controller.vala
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ namespace org.westhoffswelt.pdfpresenter {
*/
protected bool ignore_input_events = false;

/**
* Notes for the slides
*/
protected SlidesNotes notes;

/**
* Instantiate a new controller
*/
public PresentationController() {
public PresentationController(SlidesNotes notes) {
this.controllables = new List<Controllable>();
this.notes = notes;
}

/**
Expand Down Expand Up @@ -86,6 +92,9 @@ namespace org.westhoffswelt.pdfpresenter {
case 0x065: /* e */
this.controllables_edit_note();
break;
case 0x073: /* s */
this.notes.save_to_disk();
break;
}
return true;
} else {
Expand Down
51 changes: 45 additions & 6 deletions src/classes/slides_notes.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,65 @@ namespace org.westhoffswelt.pdfpresenter {
/**
* The array where we will store the text of the notes
*/
protected string[] notes;
protected string?[] notes;

public void set_note(string note, int slide_number) {
/**
* File name for notes
*/
protected string? fname = null;

/**
* Set a note for a given slide
*/
public void set_note( string note, int slide_number ) {
if (slide_number != -1) {
if (notes.length <= slide_number)
notes.resize(slide_number+1);
notes[slide_number] = note;
}
}

public string get_note_for_slide(int number) {
/**
* Return the text of a note
*/
public string get_note_for_slide( int number ) {
if (number >= notes.length || notes[number] == null)
return "";
else
return notes[number];
}

/**
* Does the user want notes?
*/
public bool has_notes() {
return notes.length > 0;
return fname != null;
}

public SlidesNotes(string? fname) {
/**
* Save the notes to the filename given in the constructor
*/
public void save_to_disk() {
if (fname != null) {
try {
string text="";
for (int i = 0; i < notes.length; ++i) {
if (notes[i] != null) {
text += @"# $(i+1)\n" + notes[i];
if (text[text.length-1] != '\n') // [last] == '\0'
text += "\n";
}
}
FileUtils.set_contents(fname, text);
} catch (Error e) {
stderr.printf ("%s\n", e.message);
}
}
}

public SlidesNotes( string? filename ) {
if (filename != null) {
fname = filename;
try {
string raw_data;
FileUtils.get_contents(fname, out raw_data);
Expand All @@ -68,7 +104,10 @@ namespace org.westhoffswelt.pdfpresenter {
}
set_note(current_note, current_slide);
} catch(GLib.FileError e) {
stderr.printf("Could not read notes from file %s\n", fname);
if (e is FileError.NOENT) // If file doesn't exits this is no problem
stdout.printf("Creating new file %s for notes\n", fname);
else
stderr.printf("Could not read notes from file %s\n", fname);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/pdf_presenter_console.vala
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ namespace org.westhoffswelt.pdfpresenter {
this.parse_command_line_options( args );

stdout.printf( "Initializing rendering...\n" );

SlidesNotes notes = new SlidesNotes(Options.notes_fname);

// Initialize global controller and CacheStatus, to manage
// crosscutting concerns between the different windows.
this.controller = new PresentationController();
this.controller = new PresentationController(notes);
this.cache_status = new CacheStatus();

int presenter_monitor, presentation_monitor;
Expand All @@ -155,8 +157,6 @@ namespace org.westhoffswelt.pdfpresenter {
presentation_monitor = 0;
}

SlidesNotes notes = new SlidesNotes(Options.notes_fname);

if ( Gdk.Screen.get_default().get_n_monitors() > 1 ) {
this.presentation_window =
this.create_presentation_window( args[1], presentation_monitor );
Expand Down