diff --git a/components/tvplanit/examples/fulldemo/demomain.lfm b/components/tvplanit/examples/fulldemo/demomain.lfm index f7552abfd..d995b467b 100644 --- a/components/tvplanit/examples/fulldemo/demomain.lfm +++ b/components/tvplanit/examples/fulldemo/demomain.lfm @@ -77,8 +77,10 @@ object MainForm: TMainForm Height = 197 Top = 331 Width = 333 + ShowHint = True ControlLink = VpControlLink1 Color = clWindow + ParentShowHint = False Align = alBottom TabStop = True TabOrder = 0 @@ -117,6 +119,7 @@ object MainForm: TMainForm Height = 284 Top = 42 Width = 333 + ShowHint = True ControlLink = VpControlLink1 Color = clWindow Font.Height = -12 @@ -572,6 +575,17 @@ object MainForm: TMainForm OnChange = CbDragDropTransparentChange TabOrder = 7 end + object CbShowEventHints: TCheckBox + Left = 349 + Height = 19 + Top = 117 + Width = 110 + Caption = 'Show event hints' + Checked = True + OnChange = CbShowEventHintsChange + State = cbChecked + TabOrder = 8 + end end end end diff --git a/components/tvplanit/examples/fulldemo/demomain.pas b/components/tvplanit/examples/fulldemo/demomain.pas index 192655f3d..d634be126 100644 --- a/components/tvplanit/examples/fulldemo/demomain.pas +++ b/components/tvplanit/examples/fulldemo/demomain.pas @@ -12,7 +12,7 @@ uses ExtCtrls, StdCtrls, ComCtrls, LCLTranslator, Menus, Types, LCLVersion, VpBaseDS, VpDayView, VpWeekView, VpTaskList, VpAbout, VpContactGrid, VpMonthView, VpResEditDlg, VpContactButtons, VpNavBar, VpData, - VpPrtPrvDlg, VpPrtFmtDlg, VpBase, VpCalendar; + VpPrtPrvDlg, VpPrtFmtDlg, VpBase; type @@ -31,6 +31,7 @@ type CbDrawingStyle: TComboBox; CbAllowDragAndDrop: TCheckBox; CbDragDropTransparent: TCheckBox; + CbShowEventHints: TCheckBox; Img: TImage; ImageList1: TImageList; LblDrawingStyle: TLabel; @@ -98,6 +99,7 @@ type procedure CbFirstDayOfWeekChange(Sender: TObject); procedure CbGranularityChange(Sender: TObject); procedure CbLanguagesChange(Sender: TObject); + procedure CbShowEventHintsChange(Sender: TObject); procedure CbTimeFormatChange(Sender: TObject); procedure DaysTrackBarChange(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); @@ -396,6 +398,17 @@ begin SetLanguage(CbLanguages.ItemIndex); end; +procedure TMainForm.CbShowEventHintsChange(Sender: TObject); +begin + VpDayView1.HintMode := hmEventHint; + VpWeekView1.HintMode := hmEventHint; + VpMonthView1.HintMode := hmEventHint; + + VpDayView1.ShowHint := CbShowEventHints.Checked; + VpWeekView1.ShowHint := CbShowEventHints.Checked; + VpMonthView1.ShowHint := CbShowEventHints.Checked; +end; + procedure TMainForm.CbTimeFormatChange(Sender: TObject); begin VpDayView1.TimeFormat := TVpTimeFormat(CbTimeFormat.ItemIndex); @@ -702,7 +715,7 @@ begin CbAllowInplaceEditing.Left := CbLanguages.Left + CbLanguages.Width + 32; CbAllowDragAndDrop.Left := CbAllowInplaceEditing.Left; CbDragDropTransparent.Left := CbAllowInplaceEditing.Left; - w := GetLabelWidth(LblDrawingStyle); + CbShowEventHints.Left := CbAllowInplaceEditing.Left; // Planner pages DaysTrackbar.Left := GetLabelWidth(LblVisibleDays) + LblVisibleDays.Left + 8; @@ -799,6 +812,10 @@ begin CbDragDropTransparent.Checked); CbDragDropTransparentChange(nil); + CbShowEventHints.Checked := ini.ReadBool('Settings', 'ShowEventHints', + CbShowEventHints.Checked); + CbShowEventHintsChange(nil); + FResID := ini.ReadInteger('Data', 'ResourceID', -1); finally ini.Free; @@ -834,6 +851,7 @@ begin ini.WriteBool('Settings', 'AllowInplaceEditing', CbAllowInplaceEditing.Checked); ini.WriteBool('Settings', 'AllowDragAndDrop', CbAllowDragAndDrop.Checked); ini.WriteBool('Settings', 'DragAndDropTransparent', CbDragDropTransparent.Checked); + ini.WriteBool('Settings', 'ShowEventHints', CbShowEventHints.Checked); ini.WriteInteger('Data', 'ResourceID', VpControlLink1.Datastore.ResourceID); finally diff --git a/components/tvplanit/languages/demo.de.po b/components/tvplanit/languages/demo.de.po index 467dc0af7..07bc55dc1 100644 --- a/components/tvplanit/languages/demo.de.po +++ b/components/tvplanit/languages/demo.de.po @@ -8,7 +8,7 @@ msgstr "" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.8\n" +"X-Generator: Poedit 1.8.9\n" "Language: de\n" #: demomain.rs10min @@ -210,6 +210,10 @@ msgstr "\"Ziehen und Fallenlassen\" (Drag&&Drop) mit transparentem Hintergrund" msgid "30 Min" msgstr "30 Min" +#: tmainform.cbshoweventhints.caption +msgid "Show event hints" +msgstr "Ereignis-Hinweise anzeigen" + #: tmainform.lbladdressbuilder.caption msgid "Address builder" msgstr "Aufbau der Adresse:" diff --git a/components/tvplanit/languages/demo.nl.po b/components/tvplanit/languages/demo.nl.po index 070292380..6852057d4 100644 --- a/components/tvplanit/languages/demo.nl.po +++ b/components/tvplanit/languages/demo.nl.po @@ -204,6 +204,10 @@ msgstr "" msgid "30 Min" msgstr "30 Min" +#: tmainform.cbshoweventhints.caption +msgid "Show event hints" +msgstr "" + #: tmainform.lbladdressbuilder.caption msgid "Address builder" msgstr "Adres bouwer" diff --git a/components/tvplanit/languages/demo.po b/components/tvplanit/languages/demo.po index ce487c7dc..0e03eb070 100644 --- a/components/tvplanit/languages/demo.po +++ b/components/tvplanit/languages/demo.po @@ -199,6 +199,10 @@ msgstr "" msgid "30 Min" msgstr "" +#: tmainform.cbshoweventhints.caption +msgid "Show event hints" +msgstr "" + #: tmainform.lbladdressbuilder.caption msgid "Address builder" msgstr "" diff --git a/components/tvplanit/languages/demo.ru.po b/components/tvplanit/languages/demo.ru.po index 26ad6c92d..fb718ead9 100644 --- a/components/tvplanit/languages/demo.ru.po +++ b/components/tvplanit/languages/demo.ru.po @@ -213,6 +213,10 @@ msgstr "" msgid "30 Min" msgstr "30 минут" +#: tmainform.cbshoweventhints.caption +msgid "Show event hints" +msgstr "" + #: tmainform.lbladdressbuilder.caption msgid "Address builder" msgstr "Конструктор адреса" diff --git a/components/tvplanit/languages/vpsr.de.po b/components/tvplanit/languages/vpsr.de.po index 506e26041..9cc981fcd 100644 --- a/components/tvplanit/languages/vpsr.de.po +++ b/components/tvplanit/languages/vpsr.de.po @@ -45,7 +45,7 @@ msgstr "E&rinnerung" #: vpsr.rsallday msgid "All day" -msgstr "" +msgstr "Ganztags" #: vpsr.rsalldayevent msgid "&All Day Event" @@ -283,25 +283,6 @@ msgstr "Täglich" msgid "Error: Day is required." msgstr "Fehler: Tag wird benötigt" -#: vpsr.rsdaypopupadd -msgctxt "vpsr.rsdaypopupadd" -msgid "Add event..." -msgstr "Ereignis hinzufügen..." - -#: vpsr.rsdaypopupdelete -msgid "Delete event..." -msgstr "Ereignis löschen..." - -#: vpsr.rsdaypopupedit -msgctxt "vpsr.rsdaypopupedit" -msgid "Edit event..." -msgstr "Ereignis bearbeiten..." - -#: vpsr.rsdaypopupnav -msgctxt "vpsr.rsdaypopupnav" -msgid "Change date" -msgstr "Datum ändern" - #: vpsr.rsdays msgid "Days" msgstr "Tage" @@ -347,6 +328,7 @@ msgid "Contact" msgstr "Kontakt" #: vpsr.rsdlgeventedit +msgctxt "vpsr.rsdlgeventedit" msgid "Event" msgstr "Ereignis" @@ -423,6 +405,11 @@ msgstr "E-Mail" msgid "End time:" msgstr "Ende-Zeit:" +#: vpsr.rsevent +msgctxt "vpsr.rsevent" +msgid "Event" +msgstr "Ereignis" + #: vpsr.rsexclusiveeventconflict msgid "Conflicts with another exclusive event." msgstr "Konflikte mit einem anderen ausschließenden Ereignis" @@ -541,6 +528,10 @@ msgstr "M" msgid "Load file..." msgstr "Datei laden..." +#: vpsr.rslocation +msgid "Location" +msgstr "Ort" + #: vpsr.rslocationlbl msgid "Location:" msgstr "Ort:" @@ -733,9 +724,13 @@ msgstr "Außerhalb des zulässigen Bereichs" msgid "OVERDUE!" msgstr "ABGELAUFEN!" +#: vpsr.rsoverlayed +msgid "Overlayed" +msgstr "Überlagert" + #: vpsr.rsoverlayedevent msgid "overlayed" -msgstr "" +msgstr "überlagert" #: vpsr.rsownernotwinctrl msgid "Owner must be a TWinControl descendent" @@ -827,6 +822,26 @@ msgstr "Andere" msgid "Pixels" msgstr "Pixel" +#: vpsr.rspopupaddevent +msgctxt "vpsr.rspopupaddevent" +msgid "Add event..." +msgstr "Ereignis hinzufügen..." + +#: vpsr.rspopupchangedate +msgctxt "vpsr.rspopupchangedate" +msgid "Change date" +msgstr "Datum ändern" + +#: vpsr.rspopupdeleteevent +msgctxt "vpsr.rspopupdeleteevent" +msgid "&Delete event..." +msgstr "Ereignis löschen..." + +#: vpsr.rspopupeditevent +msgctxt "vpsr.rspopupeditevent" +msgid "Edit event..." +msgstr "Ereignis bearbeiten..." + #: vpsr.rspopupresourcegroups msgid "Overlay events" msgstr "Ereignisse überlagern" @@ -1143,25 +1158,6 @@ msgstr "Wöchentlich" msgid "Week of" msgstr "Woche mit" -#: vpsr.rsweekpopupadd -msgctxt "vpsr.rsweekpopupadd" -msgid "Add event..." -msgstr "Ereignis hinzufügen..." - -#: vpsr.rsweekpopupdelete -msgid "&Delete event..." -msgstr "Ereignis löschen..." - -#: vpsr.rsweekpopupedit -msgctxt "vpsr.rsweekpopupedit" -msgid "Edit event..." -msgstr "Ereignis bearbeiten..." - -#: vpsr.rsweekpopupnav -msgctxt "vpsr.rsweekpopupnav" -msgid "Change date" -msgstr "Datum ändern" - #: vpsr.rsweeks msgid "Weeks" msgstr "Wochen" @@ -1502,4 +1498,3 @@ msgstr "Unbekannte Achsen-Spezifikation: %s" #: vpsr.sxmldecnotatbeg msgid "The XML declaration must appear before the first element" msgstr "Die XML-Deklaration muss vor dem ersten Element erscheinen." - diff --git a/components/tvplanit/languages/vpsr.fr.po b/components/tvplanit/languages/vpsr.fr.po index c0c97bfb2..10f39061e 100644 --- a/components/tvplanit/languages/vpsr.fr.po +++ b/components/tvplanit/languages/vpsr.fr.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2016-09-10 21:58+0200\n" +"PO-Revision-Date: 2016-09-12 22:32+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: fr_FR\n" @@ -289,25 +289,6 @@ msgstr "Quotidien" msgid "Error: Day is required." msgstr "Erreur: Il faut choisir un jour" -#: vpsr.rsdaypopupadd -msgctxt "vpsr.rsdaypopupadd" -msgid "Add event..." -msgstr "Ajouter un événement..." - -#: vpsr.rsdaypopupdelete -msgid "Delete event..." -msgstr "Supprimer un événement..." - -#: vpsr.rsdaypopupedit -msgctxt "vpsr.rsdaypopupedit" -msgid "Edit event..." -msgstr "Modifier un événement" - -#: vpsr.rsdaypopupnav -msgctxt "vpsr.rsdaypopupnav" -msgid "Change date" -msgstr "Changez la date" - #: vpsr.rsdays msgid "Days" msgstr "Jours" @@ -353,6 +334,7 @@ msgid "Contact" msgstr "Contact" #: vpsr.rsdlgeventedit +msgctxt "vpsr.rsdlgeventedit" msgid "Event" msgstr "Événement" @@ -429,6 +411,11 @@ msgstr "E-mail" msgid "End time:" msgstr "Fin:" +#: vpsr.rsevent +msgctxt "vpsr.rsevent" +msgid "Event" +msgstr "Événement" + #: vpsr.rsexclusiveeventconflict msgid "Conflicts with another exclusive event." msgstr "Cette événement est en conflit avec une autre événement exclusif" @@ -547,6 +534,10 @@ msgstr "" msgid "Load file..." msgstr "" +#: vpsr.rslocation +msgid "Location" +msgstr "" + #: vpsr.rslocationlbl msgid "Location:" msgstr "Lieu:" @@ -739,6 +730,10 @@ msgstr "Hors de portée" msgid "OVERDUE!" msgstr "EN RETARD!" +#: vpsr.rsoverlayed +msgid "Overlayed" +msgstr "" + #: vpsr.rsoverlayedevent msgid "overlayed" msgstr "" @@ -833,6 +828,26 @@ msgstr "Autre" msgid "Pixels" msgstr "" +#: vpsr.rspopupaddevent +msgctxt "vpsr.rspopupaddevent" +msgid "Add event..." +msgstr "Ajouter un événement..." + +#: vpsr.rspopupchangedate +msgctxt "vpsr.rspopupchangedate" +msgid "Change date" +msgstr "Changer la date" + +#: vpsr.rspopupdeleteevent +msgctxt "vpsr.rspopupdeleteevent" +msgid "&Delete event..." +msgstr "&Supprimer un événement..." + +#: vpsr.rspopupeditevent +msgctxt "vpsr.rspopupeditevent" +msgid "Edit event..." +msgstr "Modifier un événement" + #: vpsr.rspopupresourcegroups msgid "Overlay events" msgstr "" @@ -1149,25 +1164,6 @@ msgstr "Hebdomadaire" msgid "Week of" msgstr "Semaine du" -#: vpsr.rsweekpopupadd -msgctxt "vpsr.rsweekpopupadd" -msgid "Add event..." -msgstr "Ajouter un événement..." - -#: vpsr.rsweekpopupdelete -msgid "&Delete event..." -msgstr "&Supprimer un événement..." - -#: vpsr.rsweekpopupedit -msgctxt "vpsr.rsweekpopupedit" -msgid "Edit event..." -msgstr "Modifier un événement..." - -#: vpsr.rsweekpopupnav -msgctxt "vpsr.rsweekpopupnav" -msgid "Change date" -msgstr "Changer la date" - #: vpsr.rsweeks msgid "Weeks" msgstr "" diff --git a/components/tvplanit/languages/vpsr.nl.po b/components/tvplanit/languages/vpsr.nl.po index 86922d983..cc8fa5de0 100644 --- a/components/tvplanit/languages/vpsr.nl.po +++ b/components/tvplanit/languages/vpsr.nl.po @@ -283,25 +283,6 @@ msgstr "Dagelijks" msgid "Error: Day is required." msgstr "Fout: Dag is verplicht" -#: vpsr.rsdaypopupadd -msgctxt "vpsr.rsdaypopupadd" -msgid "Add event..." -msgstr "Gebeurtenis toevoegen..." - -#: vpsr.rsdaypopupdelete -msgid "Delete event..." -msgstr "Gebeurtenis wissen..." - -#: vpsr.rsdaypopupedit -msgctxt "vpsr.rsdaypopupedit" -msgid "Edit event..." -msgstr "Gebeurtenis bewerken..." - -#: vpsr.rsdaypopupnav -msgctxt "vpsr.rsdaypopupnav" -msgid "Change date" -msgstr "Datum wijzigen" - #: vpsr.rsdays msgid "Days" msgstr "Dagen" @@ -347,6 +328,7 @@ msgid "Contact" msgstr "Contact" #: vpsr.rsdlgeventedit +msgctxt "vpsr.rsdlgeventedit" msgid "Event" msgstr "Gebeurtenis" @@ -423,6 +405,11 @@ msgstr "E-Mail" msgid "End time:" msgstr "Eind tijd:" +#: vpsr.rsevent +msgctxt "vpsr.rsevent" +msgid "Event" +msgstr "Gebeurtenis" + #: vpsr.rsexclusiveeventconflict msgid "Conflicts with another exclusive event." msgstr "Conflict met een andere gebeurtenis." @@ -541,6 +528,10 @@ msgstr "M" msgid "Load file..." msgstr "" +#: vpsr.rslocation +msgid "Location" +msgstr "" + #: vpsr.rslocationlbl msgid "Location:" msgstr "Plaats:" @@ -733,6 +724,10 @@ msgstr "Buiten geldig bereik" msgid "OVERDUE!" msgstr "OVER TIJD!" +#: vpsr.rsoverlayed +msgid "Overlayed" +msgstr "" + #: vpsr.rsoverlayedevent msgid "overlayed" msgstr "" @@ -827,6 +822,26 @@ msgstr "Andere" msgid "Pixels" msgstr "" +#: vpsr.rspopupaddevent +msgctxt "vpsr.rspopupaddevent" +msgid "Add event..." +msgstr "Gebeurtenis toevoegen..." + +#: vpsr.rspopupchangedate +msgctxt "vpsr.rspopupchangedate" +msgid "Change date" +msgstr "Datum wijzigen" + +#: vpsr.rspopupdeleteevent +msgctxt "vpsr.rspopupdeleteevent" +msgid "&Delete event..." +msgstr "Gebeurtenis wissen..." + +#: vpsr.rspopupeditevent +msgctxt "vpsr.rspopupeditevent" +msgid "Edit event..." +msgstr "Gebeurtenis bewerken..." + #: vpsr.rspopupresourcegroups msgid "Overlay events" msgstr "" @@ -1143,25 +1158,6 @@ msgstr "Wekelijks" msgid "Week of" msgstr "Week van" -#: vpsr.rsweekpopupadd -msgctxt "vpsr.rsweekpopupadd" -msgid "Add event..." -msgstr "Gebeurtenis toevoegen..." - -#: vpsr.rsweekpopupdelete -msgid "&Delete event..." -msgstr "Gebeurtenis wissen..." - -#: vpsr.rsweekpopupedit -msgctxt "vpsr.rsweekpopupedit" -msgid "Edit event..." -msgstr "Gebeurtenis bewerken..." - -#: vpsr.rsweekpopupnav -msgctxt "vpsr.rsweekpopupnav" -msgid "Change date" -msgstr "Datum wijzigen" - #: vpsr.rsweeks msgid "Weeks" msgstr "" diff --git a/components/tvplanit/languages/vpsr.po b/components/tvplanit/languages/vpsr.po index 1da5ce81e..c30e42f5b 100644 --- a/components/tvplanit/languages/vpsr.po +++ b/components/tvplanit/languages/vpsr.po @@ -273,25 +273,6 @@ msgstr "" msgid "Error: Day is required." msgstr "" -#: vpsr.rsdaypopupadd -msgctxt "vpsr.rsdaypopupadd" -msgid "Add event..." -msgstr "" - -#: vpsr.rsdaypopupdelete -msgid "Delete event..." -msgstr "" - -#: vpsr.rsdaypopupedit -msgctxt "vpsr.rsdaypopupedit" -msgid "Edit event..." -msgstr "" - -#: vpsr.rsdaypopupnav -msgctxt "vpsr.rsdaypopupnav" -msgid "Change date" -msgstr "" - #: vpsr.rsdays msgid "Days" msgstr "" @@ -337,6 +318,7 @@ msgid "Contact" msgstr "" #: vpsr.rsdlgeventedit +msgctxt "vpsr.rsdlgeventedit" msgid "Event" msgstr "" @@ -413,6 +395,11 @@ msgstr "" msgid "End time:" msgstr "" +#: vpsr.rsevent +msgctxt "vpsr.rsevent" +msgid "Event" +msgstr "" + #: vpsr.rsexclusiveeventconflict msgid "Conflicts with another exclusive event." msgstr "" @@ -531,6 +518,10 @@ msgstr "" msgid "Load file..." msgstr "" +#: vpsr.rslocation +msgid "Location" +msgstr "" + #: vpsr.rslocationlbl msgid "Location:" msgstr "" @@ -723,6 +714,10 @@ msgstr "" msgid "OVERDUE!" msgstr "" +#: vpsr.rsoverlayed +msgid "Overlayed" +msgstr "" + #: vpsr.rsoverlayedevent msgid "overlayed" msgstr "" @@ -817,6 +812,26 @@ msgstr "" msgid "Pixels" msgstr "" +#: vpsr.rspopupaddevent +msgctxt "vpsr.rspopupaddevent" +msgid "Add event..." +msgstr "" + +#: vpsr.rspopupchangedate +msgctxt "vpsr.rspopupchangedate" +msgid "Change date" +msgstr "" + +#: vpsr.rspopupdeleteevent +msgctxt "vpsr.rspopupdeleteevent" +msgid "&Delete event..." +msgstr "" + +#: vpsr.rspopupeditevent +msgctxt "vpsr.rspopupeditevent" +msgid "Edit event..." +msgstr "" + #: vpsr.rspopupresourcegroups msgid "Overlay events" msgstr "" @@ -1133,25 +1148,6 @@ msgstr "" msgid "Week of" msgstr "" -#: vpsr.rsweekpopupadd -msgctxt "vpsr.rsweekpopupadd" -msgid "Add event..." -msgstr "" - -#: vpsr.rsweekpopupdelete -msgid "&Delete event..." -msgstr "" - -#: vpsr.rsweekpopupedit -msgctxt "vpsr.rsweekpopupedit" -msgid "Edit event..." -msgstr "" - -#: vpsr.rsweekpopupnav -msgctxt "vpsr.rsweekpopupnav" -msgid "Change date" -msgstr "" - #: vpsr.rsweeks msgid "Weeks" msgstr "" diff --git a/components/tvplanit/languages/vpsr.ru.po b/components/tvplanit/languages/vpsr.ru.po index 8e7f82d58..5b91c6a6b 100644 --- a/components/tvplanit/languages/vpsr.ru.po +++ b/components/tvplanit/languages/vpsr.ru.po @@ -283,25 +283,6 @@ msgstr "Ежедневное" msgid "Error: Day is required." msgstr "Ошибка: Необходимо указать день" -#: vpsr.rsdaypopupadd -msgctxt "vpsr.rsdaypopupadd" -msgid "Add event..." -msgstr "Добавить событие..." - -#: vpsr.rsdaypopupdelete -msgid "Delete event..." -msgstr "Удалить событие..." - -#: vpsr.rsdaypopupedit -msgctxt "vpsr.rsdaypopupedit" -msgid "Edit event..." -msgstr "Изменить событие..." - -#: vpsr.rsdaypopupnav -msgctxt "vpsr.rsdaypopupnav" -msgid "Change date" -msgstr "Изменить дату" - #: vpsr.rsdays msgid "Days" msgstr "Дни" @@ -347,6 +328,7 @@ msgid "Contact" msgstr "Контакт" #: vpsr.rsdlgeventedit +msgctxt "vpsr.rsdlgeventedit" msgid "Event" msgstr "Событие" @@ -423,6 +405,11 @@ msgstr "Электронная почта" msgid "End time:" msgstr "Время окончания:" +#: vpsr.rsevent +msgctxt "vpsr.rsevent" +msgid "Event" +msgstr "Событие" + #: vpsr.rsexclusiveeventconflict msgid "Conflicts with another exclusive event." msgstr "Конфликт с другим важным событием." @@ -541,6 +528,10 @@ msgstr "" msgid "Load file..." msgstr "Загрузить файл..." +#: vpsr.rslocation +msgid "Location" +msgstr "" + #: vpsr.rslocationlbl msgid "Location:" msgstr "Расположение:" @@ -733,6 +724,10 @@ msgstr "За пределами диапазона" msgid "OVERDUE!" msgstr "ПРОСРОЧЕНО!" +#: vpsr.rsoverlayed +msgid "Overlayed" +msgstr "" + #: vpsr.rsoverlayedevent msgid "overlayed" msgstr "" @@ -827,6 +822,26 @@ msgstr "Другой" msgid "Pixels" msgstr "" +#: vpsr.rspopupaddevent +msgctxt "vpsr.rspopupaddevent" +msgid "Add event..." +msgstr "Добавить событие..." + +#: vpsr.rspopupchangedate +msgctxt "vpsr.rspopupchangedate" +msgid "Change date" +msgstr "Изменить дату" + +#: vpsr.rspopupdeleteevent +msgctxt "vpsr.rspopupdeleteevent" +msgid "&Delete event..." +msgstr "Удалить событие..." + +#: vpsr.rspopupeditevent +msgctxt "vpsr.rspopupeditevent" +msgid "Edit event..." +msgstr "Изменить событие..." + #: vpsr.rspopupresourcegroups msgid "Overlay events" msgstr "" @@ -1143,25 +1158,6 @@ msgstr "Еженедельно" msgid "Week of" msgstr "Неделя" -#: vpsr.rsweekpopupadd -msgctxt "vpsr.rsweekpopupadd" -msgid "Add event..." -msgstr "Добавить событие..." - -#: vpsr.rsweekpopupdelete -msgid "&Delete event..." -msgstr "Удалить событие..." - -#: vpsr.rsweekpopupedit -msgctxt "vpsr.rsweekpopupedit" -msgid "Edit event..." -msgstr "Изменить событие..." - -#: vpsr.rsweekpopupnav -msgctxt "vpsr.rsweekpopupnav" -msgid "Change date" -msgstr "Изменить дату" - #: vpsr.rsweeks msgid "Weeks" msgstr "" diff --git a/components/tvplanit/source/vpbase.pas b/components/tvplanit/source/vpbase.pas index 178247714..77e2f5fff 100644 --- a/components/tvplanit/source/vpbase.pas +++ b/components/tvplanit/source/vpbase.pas @@ -71,6 +71,8 @@ type TVpPlaySoundMode = (psmSync, psmAsync, psmStop); + TVpHintMode = (hmEventHint, hmComponentHint); + { XML definitions } DOMString = WideString; diff --git a/components/tvplanit/source/vpcalendar.pas b/components/tvplanit/source/vpcalendar.pas index 01d59c635..b0aec5651 100644 --- a/components/tvplanit/source/vpcalendar.pas +++ b/components/tvplanit/source/vpcalendar.pas @@ -132,7 +132,7 @@ type FMonth : Integer; {calendar month} FReadOnly : Boolean; {true if in read only mode} FWantDblClicks : Boolean; {true to include cs_dblclks style} - FWeekStarts : TVpDayType; {the day that begins the week} + FWeekStarts : TVpDayType; {the day that begins the week} FYear : Integer; {calendar year} FLastRenderX : Integer; FLastRenderY : Integer; diff --git a/components/tvplanit/source/vpconst.pas b/components/tvplanit/source/vpconst.pas index 0960c9292..d0f3ddffd 100644 --- a/components/tvplanit/source/vpconst.pas +++ b/components/tvplanit/source/vpconst.pas @@ -256,12 +256,15 @@ const VpXSLImplementation = 0.0; VpXMLSpecification = '1.0'; -{ Defaults } + { Defaults } { MonthView } - vpDefWVRClickChangeDate = True; + { Hint support } + MAX_HINT_WIDTH = 400; + + implementation initialization diff --git a/components/tvplanit/source/vpdayview.pas b/components/tvplanit/source/vpdayview.pas index dfca3e782..a3c6b3ead 100644 --- a/components/tvplanit/source/vpdayview.pas +++ b/components/tvplanit/source/vpdayview.pas @@ -63,8 +63,8 @@ uses {$ELSE} Windows, Messages, {$ENDIF} - Classes, Graphics, Controls, ExtCtrls, StdCtrls, - Buttons, VpBase, VpBaseDS, VpMisc, VpData, VpSR, VpConst, + Classes, Graphics, Controls, ExtCtrls, StdCtrls, Buttons, Forms, + VpBase, VpBaseDS, VpMisc, VpData, VpSR, VpConst, VpCanvasUtils, Menus; type @@ -222,6 +222,11 @@ type { TVpDayView } TVpDayView = class(TVpLinkableControl) + private + FHintMode: TVpHintMode; + FHintWindow: THintWindow; + FMouseEvent: TVpEvent; + protected{ private } FGranularity: TVpGranularity; FColumnWidth: Integer; @@ -324,11 +329,17 @@ type procedure SetWrapStyle(const v: TVpDVWrapStyle); procedure SetDotDotDotColor(const v: TColor); procedure SetShowEventTimes(Value: Boolean); + { drag-drop methods } procedure DoStartDrag(var DragObject: TDragObject); override; procedure DoEndDrag(Target: TObject; X, Y: Integer); override; procedure DragOver(Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); override; + + { Hints } + procedure ShowHintWindow(APoint: TPoint; AEvent: TVpEvent); + procedure HideHintWindow; + { internal methods } function dvCalcRowHeight(Scale: Extended; UseGran: TVpGranularity): Integer; function dvCalcVisibleLines(RenderHeight, ColHeadHeight, RowHeight: Integer; @@ -363,16 +374,20 @@ type procedure dvScrollVertical(Lines: Integer); procedure CreateParams(var Params: TCreateParams); override; procedure CreateWnd; override; - procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override; + procedure MouseEnter; override; + procedure MouseLeave; override; procedure MouseMove(Shift: TShiftState; X,Y: Integer); override; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override; + procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override; procedure SetActiveEventByCoord(APoint: TPoint); - function EditEventAtCoord(Point: TPoint): Boolean; - function GetEventAtCoord(Point: TPoint): TVpEvent; + function EditEventAtCoord(APoint: TPoint): Boolean; + function GetEventAtCoord(APoint: TPoint): TVpEvent; + function GetEventRect(AEvent: TVpEvent): TRect; procedure EditEvent; procedure EndEdit(Sender: TObject); procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure SetTimeIntervals(UseGran: TVpGranularity); + { message handlers } procedure VpDayViewInit(var Msg: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF}); message Vp_DayViewInit; {$IFNDEF LCL} @@ -396,6 +411,8 @@ type public constructor Create(AOwner: TComponent); override; destructor Destroy; override; + + function BuildEventString(AEvent: TVpEvent; UseAsHint: Boolean): String; procedure LoadLanguage; procedure DeleteActiveEvent(Verify: Boolean); @@ -459,6 +476,7 @@ type property IncludeWeekends: Boolean read FIncludeWeekends write SetIncludeWeekends default True; property NumDays: Integer read FNumDays write SetNumDays default 1; property WrapStyle: TVpDVWrapStyle read FWrapStyle Write SetWrapStyle default wsIconFlow; + property HintMode: TVpHintMode read FHintMode write FHintMode default hmEventHint; {events} property AfterEdit: TVpAfterEditEvent read FAfterEdit write FAfterEdit; property BeforeEdit: TVpBeforeEditEvent read FBeforeEdit write FBeforeEdit; @@ -473,7 +491,7 @@ type implementation uses - SysUtils, Math, Forms, Dialogs, + SysUtils, StrUtils, Math, Dialogs, VpEvntEditDlg, VpDayViewPainter; (*****************************************************************************) @@ -746,6 +764,7 @@ begin FDotDotDotColor := clBlack; FIncludeWeekends := True; FAllowInplaceEdit := true; + FShowEventTimes := true; { set up fonts and colors } FHeadAttr.Font.Size := 10; @@ -789,6 +808,7 @@ end; destructor TVpDayView.Destroy; begin FreeAndNil(dvInplaceEditor); + FreeAndNil(FHintWindow); FTimeSlotColors.Free; FHeadAttr.Free; @@ -807,6 +827,97 @@ begin inherited; end; +function TVpDayView.BuildEventString(AEvent: TVpEvent; + UseAsHint: Boolean): String; +var + timeFmt: String; + timeStr: String; + s: String; + res: TVpResource; + grp: TVpResourceGroup; + isOverlayed: Boolean; + showDetails: Boolean; +begin + Result := ''; + + if (AEvent = nil) or (Datastore = nil) or (Datastore.Resource = nil) then + exit; + + grp := Datastore.Resource.Group; + showDetails := (grp <> nil) and (odEventDescription in grp.ShowDetails); + isOverlayed := AEvent.IsOverlayed; + timefmt := GetTimeFormatStr(TimeFormat); + + if UseAsHint then begin + { Usage as hint } + if isOverlayed then begin + grp := Datastore.Resource.Group; + if (odResource in grp.ShowDetails) then begin + res := Datastore.Resources.GetResource(AEvent.ResourceID); + Result := RSOverlayed + ': ' + res.Description; + end else + Result := RSOverlayed; + end else + showDetails := true; + + timeStr := IfThen(AEvent.AllDayEvent, + RSAllDay, + FormatDateTime(timeFmt, AEvent.StartTime) + ' - ' + FormatDateTime(timeFmt, AEvent.EndTime) + ); + + Result := IfThen(Result = '', + timeStr, + Result + LineEnding + timeStr + ); + + if showDetails then begin + // Event description + Result := Result + LineEnding + LineEnding + + RSEvent + ':' + LineEnding + AEvent.Description; + + // Event notes + if (AEvent.Notes <> '') then begin + s := WrapText(AEvent.Notes, MAX_HINT_WIDTH); + s := StripLastLineEnding(s); + Result := Result + LineEnding + LineEnding + + RSNotes + ':' + LineEnding + s; + end; + + // Event location + if (AEvent.Location <> '') then + Result := Result + LineEnding + LineEnding + + RSLocation + ':' + LineEnding + AEvent.Location; + end; + end + else + begin + { Usage as cell text } + if isOverlayed then begin + Result := '[' + RSOverlayedEvent + '] '; + if showDetails then begin + res := Datastore.Resources.GetResource(AEvent.ResourceID); + if res <> nil then + Result := '[' + res.Description + '] ' + end; + end else + showDetails := true; + + timeStr := IfThen(ShowEventTimes, Format('%s - %s: ', [ + FormatDateTime(timeFmt, AEvent.StartTime), + FormatDateTime(timeFmt, AEvent.EndTime) + ])); + + if showDetails then + Result := IfThen(Result = '', + timeStr + AEvent.Description, + Result + timeStr + AEvent.Description) + else + Result := IfThen(Result = '', + timeStr, + Result + timeStr); + end; +end; + procedure TVpDayView.LoadLanguage; begin dvDayUpBtn.Hint := RSNextDay; @@ -884,7 +995,60 @@ begin end; end; end; -{=====} + +{ Hint support } +procedure TVpDayView.ShowHintWindow(APoint: TPoint; AEvent: TVpEvent); +var + txt: String; + R, eventR: TRect; +begin + if FHintMode = hmEventHint then + begin + if (AEvent = nil) or + ((Datastore = nil) or (Datastore.Resource = nil)) then + begin + HideHintWindow; + exit; + end; + + txt := BuildEventString(AEvent, true); + + if (txt <> '') and + not ((dvInPlaceEditor <> nil) and dvInplaceEditor.Visible) and + not (csDesigning in ComponentState) then + begin + if FHintWindow = nil then + FHintWindow := THintWindow.Create(nil); + eventR := GetEventRect(AEvent); + eventR.TopLeft := ClientToScreen(eventR.TopLeft); + eventR.BottomRight := ClientToScreen(eventR.BottomRight); + APoint := ClientToScreen(APoint); + R := FHintWindow.CalcHintRect(MAX_HINT_WIDTH, txt, nil); + OffsetRect(R, APoint.X - WidthOf(R), eventR.Bottom); + FHintWindow.ActivateHint(R, txt); + end else + HideHintWindow; + end + else + if FHintMode = hmComponentHint then + begin + Application.Hint := Hint; + Application.ActivateHint(ClientToScreen(APoint), true); + end; +end; + +procedure TVpDayView.HideHintWindow; +begin + case FHintMode of + hmEventHint: + FreeAndNil(FHintWindow); + hmComponentHint: + Application.CancelHint; + end; +end; + + +{ Popup menu } procedure TVpDayView.InitializeDefaultPopup; var @@ -895,26 +1059,26 @@ begin canEdit := (FActiveEvent <> nil) and FActiveEvent.CanEdit; FDefaultPopup.Items.Clear; - if RSDayPopupAdd <> '' then begin + if RSPopupAddEvent <> '' then begin NewItem := TMenuItem.Create(Self); - NewItem.Caption := RSDayPopupAdd; + NewItem.Caption := RSPopupAddEvent; NewItem.OnClick := PopupAddEvent; NewItem.Tag := 0; FDefaultPopup.Items.Add(NewItem); end; - if RSDayPopupEdit <> '' then begin + if RSPopupEditEvent <> '' then begin NewItem := TMenuItem.Create(Self); - NewItem.Caption := RSDayPopupEdit; + NewItem.Caption := RSPopupEditEvent; NewItem.Enabled := canEdit; NewItem.OnClick := PopupEditEvent; NewItem.Tag := 1; FDefaultPopup.Items.Add(NewItem); end; - if RSDayPopupDelete <> '' then begin + if RSPopupDeleteEvent <> '' then begin NewItem := TMenuItem.Create(Self); - NewItem.Caption := RSDayPopupDelete; + NewItem.Caption := RSPopupDeleteEvent; NewItem.Enabled := canEdit; NewItem.OnClick := PopupDeleteEvent; NewItem.Tag := 1; @@ -925,9 +1089,9 @@ begin NewItem.Caption := '-'; FDefaultPopup.Items.Add(NewItem); - if RSDayPopupNav <> '' then begin + if RSPopupChangeDate <> '' then begin NewItem := TMenuItem.Create(Self); - NewItem.Caption := RSDayPopupNav; + NewItem.Caption := RSPopupChangeDate; NewItem.Tag := 0; FDefaultPopup.Items.Add(NewItem); @@ -1644,6 +1808,16 @@ begin end; +procedure TVpDayView.MouseEnter; +begin + FMouseEvent := nil; +end; + +procedure TVpDayView.MouseLeave; +begin + HideHintWindow; +end; + procedure TVpDayView.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin @@ -1660,6 +1834,8 @@ begin end; procedure TVpDayView.MouseMove(Shift: TShiftState; X, Y: Integer); +var + event: TVpEvent; begin inherited MouseMove(Shift, X, Y); if (FActiveEvent <> nil) and (not ReadOnly) then begin @@ -1672,6 +1848,16 @@ begin BeginDrag(true); end; end; + + if ShowHint then + begin + event := GetEventAtCoord(Point(X, Y)); + if FMouseEvent <> event then begin + Application.CancelHint; + ShowHintWindow(Point(X, Y), event); + FMouseEvent := event; + end; + end; end; procedure TVpDayView.MouseDown(Button: TMouseButton; Shift: TShiftState; @@ -1916,7 +2102,7 @@ begin end; end; -function TVpDayView.EditEventAtCoord(Point: TPoint): Boolean; +function TVpDayView.EditEventAtCoord(APoint: TPoint): Boolean; var I: Integer; begin @@ -1930,7 +2116,7 @@ begin if dvEventArray[I].Event = nil then { we've hit the end of visible events without finding a match } Exit; - if PointInRect(Point, dvEventArray[I].Rec) then + if PointInRect(APoint, dvEventArray[I].Rec) then begin FActiveEvent := TVpEvent(dvEventArray[I].Event); dvActiveEventRec := dvEventArray[I].Rec; @@ -1943,7 +2129,7 @@ begin end; {=====} -function TVpDayView.GetEventAtCoord(Point: TPoint): TVpEvent; +function TVpDayView.GetEventAtCoord(APoint: TPoint): TVpEvent; var I: Integer; begin @@ -1951,14 +2137,24 @@ begin for I := 0 to pred(Length(dvEventArray)) do begin if dvEventArray[I].Event = nil then Exit; - if PointInRect(Point, dvEventArray[I].Rec) then + if PointInRect(APoint, dvEventArray[I].Rec) then begin result := TVpEvent(dvEventArray[I].Event); Exit; end; end; end; -{=====} + +function TVpDayView.GetEventRect(AEvent: TVpEvent): TRect; +var + i: Integer; +begin + for i:=0 to High(dvEventArray) do + if dvEventArray[i].Event = AEvent then begin + Result := dvEventArray[i].Rec; + exit; + end; +end; procedure TVpDayView.dvEditInPlace(Sender: TObject); begin diff --git a/components/tvplanit/source/vpdayviewpainter.pas b/components/tvplanit/source/vpdayviewpainter.pas index 86f8ceb75..e338383c9 100644 --- a/components/tvplanit/source/vpdayviewpainter.pas +++ b/components/tvplanit/source/vpdayviewpainter.pas @@ -76,7 +76,6 @@ type OldFont: TFont; protected - function BuildEventString(AEvent: TVpEvent): String; procedure CalcRowHeadRect(out ARect: TRect); function CalcRowHeadWidth: Integer; function CountOverlappingEvents(Event: TVpEvent; const EArray: TVpDvEventArray): Integer; @@ -145,44 +144,6 @@ begin FDayView := ADayView; end; -function TVpDayViewPainter.BuildEventString(AEvent: TVpEvent): String; -var - maxW: Integer; - timeFmt: String; - res: TVpResource; - grp: TVpResourceGroup; - isOverlayed: Boolean; -begin - Result := ''; - - grp := FDayView.Datastore.Resource.Group; - isOverlayed := AEvent.IsOverlayed; - - if isOverlayed then begin - if (grp <> nil) and (odResource in grp.ShowDetails) then begin - res := FDayView.Datastore.Resources.GetResource(AEvent.ResourceID); - if res <> nil then - Result := '[' + res.Description + '] '; - end else - Result := '[' + RSOverlayedEvent + '] '; - end; - - if (not isOverlayed) or ((grp <> nil) and (odEventDescription in grp.ShowDetails)) then - begin - if Result <> '' then - Result := Result + ' '; - if FDayView.ShowEventTimes then begin - timeFmt := IfThen(FDayView.TimeFormat = tf24Hour, 'h:nn', 'h:nnam/pm'); - Result := Result + Format('%s - %s: %s', [ - FormatDateTime(timeFmt, AEvent.StartTime), - FormatDateTime(timeFmt, AEvent.EndTime), - AEvent.Description - ]); - end else - Result := Result + AEvent.Description; - end; -end; - { returns the number of events which overlap the specified event } function TVpDayViewPainter.CountOverlappingEvents(Event: TVpEvent; const EArray: TVpDvEventArray): Integer; @@ -942,7 +903,7 @@ begin DrawIcons(IconRect); { Build the event string } - EventString := BuildEventString(AEvent); + EventString := FDayView.BuildEventString(AEvent, false); { If the string is longer than the availble space then chop off the end and place those little '...'s at the end } diff --git a/components/tvplanit/source/vpmisc.pas b/components/tvplanit/source/vpmisc.pas index 0f20c5fd7..6ff6939cd 100644 --- a/components/tvplanit/source/vpmisc.pas +++ b/components/tvplanit/source/vpmisc.pas @@ -123,6 +123,7 @@ function DateInRange(ADate, StartDate, EndDate: TDateTime; IncludeLimits: Boolea function TimeInRange(ATime, StartTime, EndTime: TDateTime; IncludeLimits: Boolean): Boolean; function GetTimeFormat: TVpTimeFormat; +function GetTimeFormatStr(ATimeFormat: TVpTimeFormat): String; function GranularityToStr(Gran: TVpGranularity): string; function HourToAMPM(Hour: TVpHours): string; function HourToStr(Hour: TVpHours; Mil: Boolean): string; @@ -496,13 +497,24 @@ end; function GetTimeFormat: TVpTimeFormat; var s: String; + p: Integer; begin s := lowercase(FormatDateTime('hh:nn ampm', 0.25)); - if pos(lowercase(FormatSettings.TimeAMString), s) = Length(s) - Length(FormatSettings.TimeAMString) then - Result := tf12Hour else + p := pos(lowercase(FormatSettings.TimeAMString), s); + if p = Length(s) - Length(FormatSettings.TimeAMString) then + Result := tf12Hour + else Result := tf24Hour; end; +function GetTimeFormatStr(ATimeFormat: TVpTimeFormat): String; +begin + case ATimeFormat of + tf12Hour: Result := 'hh:nn am/pm'; + tf24Hour: Result := 'hh:nn'; + end; +end; + function GranularityToStr(Gran: TVpGranularity): string; begin Result := IntToStr(GranularityMinutes[Gran]); diff --git a/components/tvplanit/source/vpmonthview.pas b/components/tvplanit/source/vpmonthview.pas index 471ab85df..1a97c0b9f 100644 --- a/components/tvplanit/source/vpmonthview.pas +++ b/components/tvplanit/source/vpmonthview.pas @@ -112,6 +112,8 @@ type { TVpMonthView } TVpMonthView = class(TVpLinkableControl) + private + FHintMode: TVpHintMode; protected{ private } FKBNavigate: Boolean; FColumnWidth: Integer; @@ -263,6 +265,7 @@ type property EventDayStyle: TFontStyles read FEventDayStyle write SetEventDayStyle; property EventFont: TVpFont read FEventFont write SetEventFont; property HeadAttributes: TVpMvHeadAttr read FHeadAttr write FHeadAttr; + property HintMode: TVpHintMode read FHintMode write FHintMode default hmEventHint; property LineColor: TColor read FLineColor write SetLineColor; property TimeFormat: TVpTimeFormat read FTimeFormat write SetTimeFormat; property TodayAttributes: TVpMvTodayAttr read FTodayAttr write FTodayAttr; @@ -477,13 +480,13 @@ end; destructor TVpMonthView.Destroy; begin + FreeAndNil(FHintWindow); FHeadAttr.Free; FTodayAttr.Free; FDayHeadAttr.Free; FDayNumberFont.Free; FEventFont.Free; mvSpinButtons.Free; -// mvEventList.Free; FDefaultPopup.Free; inherited; end; @@ -508,7 +511,7 @@ begin if AEvent.AllDayEvent then timeStr := RSAllDay else begin - timefmt := IfThen(TimeFormat = tf24Hour, 'hh:nn', 'hh:nn AM/PM'); + timeFmt := GetTimeFormatStr(TimeFormat); timeStr := FormatDateTime(timefmt, AEvent.StartTime); if not AStartTimeOnly then timeStr := timeStr + ' - ' + FormatDateTime(timeFmt, AEvent.EndTime); @@ -920,51 +923,63 @@ var list: TList; R: TRect; begin - if (ADate = 0) or ((Datastore = nil) or (Datastore.Resource = nil)) then + if FHintMode = hmEventHint then begin - HideHintWindow; - exit; - end; - - // Collect all events of this day and add them separated by line feeds to - // the hint string (txt). - txt := ''; - list := TList.Create; - try - Datastore.Resource.Schedule.EventsByDate(ADate, List); - for i:=0 to list.Count-1 do begin - event := TVpEvent(list[i]); - s := BuildEventString(event, true, false); - txt := IfThen(txt = '', s, txt + LineEnding + s); + if (ADate = 0) or ((Datastore = nil) or (Datastore.Resource = nil)) then + begin + HideHintWindow; + exit; end; - finally - list.Free; - end; - // If we have any events then we put the current date at the top. - if txt <> '' then begin - txt := FormatDateTime('dddddd', ADate) + LineEnding + LineEnding + txt; - if ADate = SysUtils.Date then - txt := RSToday + LineEnding + txt; - end; + // Collect all events of this day and add them separated by line feeds to + // the hint string (txt). + txt := ''; + list := TList.Create; + try + Datastore.Resource.Schedule.EventsByDate(ADate, List); + for i:=0 to list.Count-1 do begin + event := TVpEvent(list[i]); + s := BuildEventString(event, true, false); + txt := IfThen(txt = '', s, txt + LineEnding + s); + end; + finally + list.Free; + end; - if (txt <> '') and not (csDesigning in ComponentState) then + // If we have any events then we put the current date at the top. + if txt <> '' then begin + txt := FormatDateTime('dddddd', ADate) + LineEnding + LineEnding + txt; + if ADate = SysUtils.Date then + txt := RSToday + LineEnding + txt; + end; + + if (txt <> '') and not (csDesigning in ComponentState) then + begin + // Build and show the hint window + if FHintWindow = nil then + FHintWindow := THintWindow.Create(nil); + APoint := ClientToScreen(APoint); + R := FHintWindow.CalcHintRect(MaxWidth, txt, nil); + OffsetRect(R, APoint.X - WidthOf(R), APoint.Y); + FHintWindow.ActivateHint(R, txt); + end else + // Hide the hint window + HideHintWindow; + end + else + if FHintMode = hmComponentHint then begin - // Build and show the hint window - if FHintWindow = nil then - FHintWindow := THintWindow.Create(nil); - APoint := ClientToScreen(APoint); - R := FHintWindow.CalcHintRect(MaxWidth, txt, nil); - OffsetRect(R, APoint.X - WidthOf(R), APoint.Y); - FHintWindow.ActivateHint(R, txt); - end else - // Hide the hint window - HideHintWindow; + Application.Hint := Hint; + Application.ActivateHint(ClientToScreen(APoint), true); + end; end; procedure TVpMonthView.HideHintWindow; begin - FreeAndNil(FHintWindow); + case FHintMode of + hmEventHint: FreeAndNil(FHintWindow); + hmComponentHint: Application.CancelHint; + end; end; procedure TVpMonthView.InitializeDefaultPopup; @@ -1195,11 +1210,13 @@ var day: TDateTime; begin inherited MouseMove(Shift, X, Y); - day := GetDateAtCoord(Point(X, Y)); - if FMouseDate <> day then begin - Application.CancelHint; - ShowHintWindow(Point(X, Y), day); - FMouseDate := day; + if ShowHint then + begin + day := GetDateAtCoord(Point(X, Y)); + if FMouseDate <> day then begin + ShowHintWindow(Point(X, Y), day); + FMouseDate := day; + end; end; end; diff --git a/components/tvplanit/source/vpmonthviewpainter.pas b/components/tvplanit/source/vpmonthviewpainter.pas index 0788d2060..61a4b0b09 100644 --- a/components/tvplanit/source/vpmonthviewpainter.pas +++ b/components/tvplanit/source/vpmonthviewpainter.pas @@ -37,7 +37,6 @@ type mvRowHeight: Integer; mvColWidth: Integer; mvLineHeight: Integer; - mvVisibleEvents: Integer; protected procedure Clear; @@ -63,7 +62,7 @@ type implementation uses - LazUtf8, StrUtils, + LazUtf8, StrUtils, Math, VpCanvasUtils, VpMisc; type @@ -477,6 +476,7 @@ var Str: String; StrLen: Integer; P: TPoint; + visibleEvents: Integer; begin RenderCanvas.Pen.Color := RealLineColor; RenderCanvas.Pen.Style := psSolid; @@ -487,6 +487,7 @@ begin (FMonthView.DataStore.Resource <> nil) and (FMonthView.DataStore.Resource.Schedule.EventCount <> 0) then begin + visibleEvents := 0; EventList := TList.Create; try for I := 0 to 43 do begin @@ -547,9 +548,9 @@ begin { Store TextRect and Event in EventArray } with TVpMonthViewOpener(FMonthView) do begin - Inc(mvVisibleEvents); - mvEventArray[mvVisibleEvents - 1].Rec := TextRect; - mvEventArray[mvVisibleEvents - 1].Event := TVpEvent(EventList.List^[j]); + Inc(visibleEvents); + mvEventArray[visibleEvents - 1].Rec := TextRect; + mvEventArray[visibleEvents - 1].Event := TVpEvent(EventList.List^[j]); end; { Move TextRect down one line for the next item... } @@ -735,7 +736,6 @@ begin DrawDayHead; { draw days } - mvVisibleEvents := 0; DrawDays; { draw the borders } @@ -754,10 +754,7 @@ procedure TVpMonthViewPainter.SetMeasurements; begin inherited; - if RenderDate = 0 then - DisplayDate := Date - else - DisplayDate := RenderDate; + DisplayDate := IfThen(RenderDate = 0, Date, RenderDate); { we use the VpProductName because is is a good representation of some } { generic text } diff --git a/components/tvplanit/source/vpsr.inc b/components/tvplanit/source/vpsr.inc index 4f5b95ac5..cd6eab6ba 100644 --- a/components/tvplanit/source/vpsr.inc +++ b/components/tvplanit/source/vpsr.inc @@ -151,6 +151,7 @@ resourcestring RSConfirmDeleteContact = 'Delete contact %s?'; {Event Specific} + RSEvent = 'Event'; RSFromSchedule = 'from your schedule?'; RSConfirmDeleteEvent = 'Delete event from schedule?'; RSStartEndTimeError = 'Incorrect order of start and end times. ' + @@ -158,6 +159,7 @@ resourcestring RSCannotEditOverlayedEvent= 'Cannot edit this overlayed event.'; RSNoOverlayedEvents = 'none'; RSOverlayedEvent = 'overlayed'; + RSOverlayed = 'Overlayed'; {Task Specific} RSConfirmDeleteTask = 'Delete this task from your list?'; @@ -167,27 +169,12 @@ resourcestring RSTaskTitleResource = 'Task list - '; {!!.01} RSTaskTitleNoResource = 'Task list'; {!!.01} - {MonthView Specific} - (* - RSMonthPopupToday = 'Today'; - RSMonthPopupNextMonth = 'Next month'; - RSMonthPopupPrevMonth = 'Previous month'; - RSMonthPopupNextYear = 'Next year'; - RSMonthPopupPrevYear = 'Previous year'; *) - - {WeekView Specific} - RSWeekPopupAdd = 'Add event...'; - RSWeekPopupEdit = 'Edit event...'; - RSWeekPopupDelete = '&Delete event...'; - RSWeekPopupNav = 'Change date'; - (* - RSWeekPopupNavToday = 'Today'; - RSWeekPopupNavNextWeek = 'Next week'; - RSWeekPopupNavPrevWeek = 'Previous week'; - RSWeekPopupNavNextMonth = 'Next month'; - RSWeekPopupNavPrevMonth = 'Previous month'; - RSWeekPopupNavNextYear = 'Next year'; - RSWeekPopupNavPrevYear = 'Previous year';*) + { Popup specific } + RSPopupAddEvent = 'Add event...'; + RSPopupEditEvent = 'Edit event...'; + RSPopupDeleteEvent = '&Delete event...'; + RSPopupChangeDate = 'Change date'; + RSPopupResourceGroups = 'Overlay events'; { Print Preview Specific } RSPrintPrvPrint = '&Print'; @@ -203,33 +190,6 @@ resourcestring RSPrintPrvCancel = 'Cancel'; RSPrintPrvCancelHint = 'Cancel preview'; - { DayView Specific } - RSDayPopupAdd = 'Add event...'; - RSDayPopupEdit = 'Edit event...'; - RSDayPopupDelete = 'Delete event...'; - RSDayPopupNav = 'Change date'; - (* - RSDayPopupNavToday = 'Today'; - RSDayPopupNavTomorrow = 'Tomorrow'; - RSDayPopupNavYesterday = 'Yesterday'; - RSDayPopupNavNextDay = 'Next day'; - RSDayPopupNavPrevDay = 'Previous day'; - RSDayPopupNavNextWeek = 'Next week'; - RSDayPopupNavPrevWeek = 'Previous week'; - RSDayPopupNavNextMonth = 'Next month'; - RSDayPopupNavPrevMonth = 'Previous month'; - RSDayPopupNavNextYear = 'Next year'; - RSDayPopupNavPrevYear = 'Previous year'; - RSHintToday = 'Today'; {!!.01} - RSHintTomorrow = 'Tomorrow'; {!!.01} - RSHintYesterday = 'Yesterday'; {!!.01} - RSHintNextWeek = 'Next week'; {!!.01} - RSHintPrevWeek = 'Previous week'; {!!.01} - RSHintPrevDay = 'Previous day'; - RsHintNextDay = 'Next day'; - *) - RSPopupResourceGroups = 'Overlay events'; - { field names } RSPosition = 'Position'; RSCompany = 'Company'; @@ -238,6 +198,7 @@ resourcestring RSCountry = 'Country'; RSCategory = 'Category'; RSNotes = 'Notes'; + RSLocation = 'Location'; RSCustom1 = 'Custom 1'; RSCustom2 = 'Custom 2'; @@ -321,19 +282,6 @@ resourcestring RS1Week = '1 week'; { Calendar } - (* - RSCalendarPrevMonth = 'Previous Month'; - RSCalendarNextMonth = 'Next Month'; - RSCalendarPrevYear = 'Previous Year'; - RSCalendarNextYear = 'Next Year'; - RSCalendarToday = 'Today'; - - RSCalendarPopupToday = 'Today'; - RSCalendarPopupNextMonth = 'Next Month'; - RSCalendarPopupPrevMonth = 'Previous Month'; - RSCalendarPopupNextYear = 'Next Year'; - RSCalendarPopupPrevYear = 'Previous Year'; - *) RSCalendarRevert = 'Revert'; RSCalendarPopupRevert = 'Revert'; diff --git a/components/tvplanit/source/vpweekview.pas b/components/tvplanit/source/vpweekview.pas index a3268842c..fa0c51b30 100644 --- a/components/tvplanit/source/vpweekview.pas +++ b/components/tvplanit/source/vpweekview.pas @@ -118,6 +118,9 @@ type TVpWeekView = class(TVpLinkableControl) private + FHintMode: TVpHintMode; + FMouseEvent: TVpEvent; + FHintWindow: THintWindow; procedure SetActiveEvent(AValue: TVpEvent); protected{ private } FActiveDate: TDateTime; @@ -140,8 +143,6 @@ type FAllowInplaceEdit: Boolean; FAllowDragAndDrop: Boolean; FDragDropTransparent: Boolean; - FMouseEvent: TVpEvent; - FHintWindow: THintWindow; { event variables } FBeforeEdit: TVpBeforeEditEvent; FAfterEdit: TVpAfterEditEvent; @@ -209,6 +210,8 @@ type procedure EditEvent; procedure EndEdit(Sender: TObject); procedure KeyDown(var Key: Word; Shift: TShiftState); override; + procedure MouseEnter; override; + procedure MouseLeave; override; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override; procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override; @@ -238,7 +241,8 @@ type public constructor Create(AOwner: TComponent); override; destructor Destroy; override; - function BuildEventString(AEvent: TVpEvent; AStartTime, AEndTime: TDateTime): String; + function BuildEventString(AEvent: TVpEvent; AStartTime, AEndTime: TDateTime; + UseAsHint: Boolean): String; procedure LoadLanguage; procedure DeleteActiveEvent(Verify: Boolean); procedure DragDrop(Source: TObject; X, Y: Integer); override; @@ -269,6 +273,7 @@ type property DrawingStyle: TVpDrawingStyle read FDrawingStyle write SetDrawingStyle stored True; property EventFont: TVpFont read FEventFont write SetEventFont; property HeadAttributes: TVpWvHeadAttributes read FHeadAttr write FHeadAttr; + property HintMode: TVpHintMode read FHintMode write FHintMode default hmEventHint; property LineColor: TColor read FLineColor write SetLineColor; property TimeFormat: TVpTimeFormat read FTimeFormat write SetTimeFormat; property ShowEventTime: Boolean read FShowEventTime write SetShowEventTime; @@ -294,7 +299,6 @@ uses SysUtils, StrUtils, LazUTF8, Dialogs, VpEvntEditDlg, VpWeekViewPainter; - (*****************************************************************************) { TVpTGInPlaceEdit } (*****************************************************************************) @@ -488,10 +492,10 @@ begin wvHookUp; SetActiveDate(Now); end; -{=====} destructor TVpWeekView.Destroy; begin + FreeAndNil(FHintWindow); FreeAndNil(wvInplaceEditor); FDayHeadAttributes.Free; FAllDayEventAttr.Free; @@ -505,12 +509,15 @@ begin end; function TVpWeekView.BuildEventString(AEvent: TVpEvent; - AStartTime, AEndTime: TDateTime): String; + AStartTime, AEndTime: TDateTime; UseAsHint: Boolean): String; var timeFmt: String; + timeStr: String; + s: String; res: TVpResource; grp: TVpResourceGroup; isOverlayed: Boolean; + showDetails: Boolean; begin Result := ''; @@ -518,31 +525,75 @@ begin exit; grp := Datastore.Resource.Group; + showDetails := (grp <> nil) and (odEventDescription in grp.ShowDetails); isOverlayed := AEvent.IsOverlayed; + timefmt := GetTimeFormatStr(TimeFormat); - if ShowEventTime then + if UseAsHint then begin + { Usage as hint } + if isOverlayed then begin + grp := Datastore.Resource.Group; + if (odResource in grp.ShowDetails) then begin + res := Datastore.Resources.GetResource(AEvent.ResourceID); + Result := RSOverlayed + ': ' + res.Description; + end else + Result := RSOverlayed; + end else + showDetails := true; + + timeStr := IfThen(AEvent.AllDayEvent, + RSAllDay, + FormatDateTime(timeFmt, AEvent.StartTime) + ' - ' + FormatDateTime(timeFmt, AEvent.EndTime) + ); + + Result := IfThen(Result = '', + timeStr, + Result + LineEnding + timeStr + ); + + if showDetails then begin + // Event description + Result := Result + LineEnding + LineEnding + + RSEvent + ':' + LineEnding + AEvent.Description; + + // Event notes + if (AEvent.Notes <> '') then begin + s := WrapText(AEvent.Notes, MAX_HINT_WIDTH); + s := StripLastLineEnding(s); + Result := Result + LineEnding + LineEnding + + RSNotes + ':' + LineEnding + s; + end; + + // Event location + if (AEvent.Location <> '') then + Result := Result + LineEnding + LineEnding + + RSLocation + ':' + LineEnding + AEvent.Location; + end; + end + else begin - timefmt := IfThen(TimeFormat = tf24Hour, 'hh:nn', 'hh:nn AM/PM'); - Result := Result + Format('%s - %s: ', [ + { Usage as cell text } + timeStr := IfThen(ShowEventTime, Format('%s - %s: ', [ FormatDateTime(timeFmt, AStartTime), FormatDateTime(timeFmt, AEndTime) - ]); - end else - Result := ''; + ])); + Result := timeStr; - if isOverlayed then - begin - if (grp <> nil) and (odResource in grp.ShowDetails) then + if isOverlayed then begin - res := Datastore.Resources.GetResource(AEvent.ResourceID); - if res <> nil then - Result := Result + '[' + res.Description + '] '; + if (grp <> nil) and (odResource in grp.ShowDetails) then + begin + res := Datastore.Resources.GetResource(AEvent.ResourceID); + if res <> nil then + Result := Result + '[' + res.Description + '] '; + end else + Result := Result + '[' + RSOverlayedEvent + '] '; end else - Result := Result + '[' + RSOverlayedEvent + '] '; - end; + showDetails := True; - if (not isOverlayed) or ((grp <> nil) and (odEventDescription in grp.ShowDetails)) then - Result := Result + AEvent.Description; + if showDetails then + Result := Result + AEvent.Description; + end; end; @@ -957,76 +1008,53 @@ end; { Hints } procedure TVpWeekView.ShowHintWindow(APoint: TPoint; AEvent: TVpEvent); -const - MaxWidth = 400; var - txt, s: String; - grp: TVpResourceGroup; - showDetails: Boolean; - res: TVpResource; - R, REv: TRect; + txt: String; + R, eventR: TRect; begin - if (AEvent = nil) or - ((Datastore = nil) or (Datastore.Resource = nil)) then + if FHintMode = hmEventHint then begin - HideHintWindow; - exit; - end; - - if AEvent.IsOverlayed then begin - grp := Datastore.Resource.Group; - showDetails := (odEventDescription in grp.ShowDetails); - if (odResource in grp.ShowDetails) then begin - res := Datastore.Resources.GetResource(AEvent.ResourceID); - txt := 'Overlayed resource: ' + res.Description; - end else - txt := 'Overlayed resource'; - end else begin - showDetails := true; - txt := ''; - end; - - if txt <> '' then - txt := txt + LineEnding; - - if AEvent.AllDayEvent then - txt := txt + 'All day' - else - txt := txt + Format('%s - %s', [ - FormatDateTime('hh:nn', AEvent.StartTime), - FormatDateTime('hh:nn', AEvent.EndTime)]); - - if showDetails then begin - txt := txt + LineEnding + LineEnding + 'Event:' + LineEnding + AEvent.Description; - if (AEvent.Notes <> '') then begin - s := WrapText(AEvent.Notes, MaxWidth); - s := StripLastLineEnding(s); - txt := txt + LineEnding + LineEnding + 'Notes:' + LineEnding + s; + if (AEvent = nil) or + ((Datastore = nil) or (Datastore.Resource = nil)) then + begin + HideHintWindow; + exit; end; - if AEvent.Location <> '' then - txt := txt + LineEnding + LineEnding + 'Location:' + LineEnding + AEvent.Location; - end; - if (txt <> '') and - not ((wvInPlaceEditor <> nil) and wvInplaceEditor.Visible) and - not (csDesigning in ComponentState) then + txt := BuildEventString(AEvent, AEvent.StartTime, AEvent.EndTime, true); + + if (txt <> '') and + not ((wvInPlaceEditor <> nil) and wvInplaceEditor.Visible) and + not (csDesigning in ComponentState) then + begin + if FHintWindow = nil then + FHintWindow := THintWindow.Create(nil); + eventR := GetEventRect(AEvent); + eventR.TopLeft := ClientToScreen(eventR.TopLeft); + eventR.BottomRight := ClientToScreen(eventR.BottomRight); + APoint := ClientToScreen(APoint); + R := FHintWindow.CalcHintRect(MAX_HINT_WIDTH, txt, nil); + OffsetRect(R, APoint.X - WidthOf(R), eventR.Bottom); + FHintWindow.ActivateHint(R, txt); + end else + HideHintWindow; + end + else + if FHintMode = hmComponentHint then begin - if FHintWindow = nil then - FHintWindow := THintWindow.Create(nil); - REv := GetEventRect(AEvent); - REv.TopLeft := ClientToScreen(REv.TopLeft); - REv.BottomRight := ClientToScreen(REv.BottomRight); - APoint := ClientToScreen(APoint); - R := FHintWindow.CalcHintRect(MaxWidth, txt, nil); - OffsetRect(R, APoint.X - WidthOf(R), REv.Bottom); - FHintWindow.ActivateHint(R, txt); - end else - HideHintWindow; + Application.Hint := Hint; + Application.ActivateHint(ClientToScreen(APoint), true); + end; end; procedure TVpWeekView.HideHintWindow; begin - FreeAndNil(FHintWindow); + case FHintMode of + hmEventHint: + FreeAndNil(FHintWindow); + hmComponentHint: + Application.CancelHint; + end; end; @@ -1041,26 +1069,26 @@ begin canEdit := (FActiveEvent <> nil) and FActiveEvent.CanEdit; FDefaultPopup.Items.Clear; - if RSWeekPopupAdd <> '' then begin + if RSPopupAddEvent <> '' then begin NewItem := TMenuItem.Create(Self); - NewItem.Caption := RSWeekPopupAdd; + NewItem.Caption := RSPopupAddEvent; NewItem.OnClick := PopupAddEvent; NewItem.Tag := 0; FDefaultPopup.Items.Add(NewItem); end; - if RSWeekPopupEdit <> '' then begin + if RSPopupEditEvent <> '' then begin NewItem := TMenuItem.Create(Self); - NewItem.Caption := RSWeekPopupEdit; + NewItem.Caption := RSPopupEditEvent; NewItem.Enabled := canEdit; NewItem.OnClick := PopupEditEvent; NewItem.Tag := 1; FDefaultPopup.Items.Add(NewItem); end; - if RSWeekPopupDelete <> '' then begin + if RSPopupDeleteEvent <> '' then begin NewItem := TMenuItem.Create(Self); - NewItem.Caption := RSWeekPopupDelete; + NewItem.Caption := RSPopupDeleteEvent; NewItem.Enabled := canEdit; NewItem.OnClick := PopupDeleteEvent; NewItem.Tag := 1; @@ -1071,9 +1099,9 @@ begin NewItem.Caption := '-'; FDefaultPopup.Items.Add(NewItem); - if RSWeekPopupNav <> '' then begin + if RSPopupChangeDate <> '' then begin NewItem := TMenuItem.Create(Self); - NewItem.Caption := RSWeekPopupNav; + NewItem.Caption := RSPopupChangeDate; NewItem.Tag := 0; FDefaultPopup.Items.Add(NewItem); @@ -1570,7 +1598,16 @@ begin // SetFocus; end; end; -{=====} + +procedure TVpWeekView.MouseEnter; +begin + FMouseEvent := nil; +end; + +procedure TVpWeekView.MouseLeave; +begin + HideHintWindow; +end; procedure TVpWeekView.MouseDown(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); @@ -1650,11 +1687,14 @@ begin end; end; - event := GetEventAtCoord(Point(X, Y)); - if FMouseEvent <> event then begin - Application.CancelHint; - ShowHintWindow(Point(X, Y), event); - FMouseEvent := event; + if ShowHint then + begin + event := GetEventAtCoord(Point(X, Y)); + if FMouseEvent <> event then begin + Application.CancelHint; + ShowHintWindow(Point(X, Y), event); + FMouseEvent := event; + end; end; end; diff --git a/components/tvplanit/source/vpweekviewpainter.pas b/components/tvplanit/source/vpweekviewpainter.pas index a8b3fe235..d69d98b64 100644 --- a/components/tvplanit/source/vpweekviewpainter.pas +++ b/components/tvplanit/source/vpweekviewpainter.pas @@ -513,7 +513,7 @@ begin RenderCanvas.Brush.Color := RealColor; { Build the event text } - dayStr := FWeekView.BuildEventString(AEvent, todayStartTime, todayEndTime); + dayStr := FWeekView.BuildEventString(AEvent, todayStartTime, todayEndTime, false); strLen := RenderCanvas.TextWidth(dayStr); if (strLen > WidthOf(TextRect) - TextMargin) then // wp: shouldn't this be 2*TextMargin ? dayStr := GetDisplayString(RenderCanvas, dayStr, 0, WidthOf(TextRect) - TextMargin * 2);