Commit 3ece9041 authored by Olivier Teulière's avatar Olivier Teulière

* all: Unified behaviours using "action list" objects

parent fd94f31b
......@@ -277,7 +277,7 @@ object AboutDlg: TAboutDlg
WordWrap = True
end
object Label3: TLabel
Left = 38
Left = 30
Top = 80
Width = 227
Height = 13
......@@ -290,7 +290,7 @@ object AboutDlg: TAboutDlg
Height = 49
end
object Label5: TLabel
Left = 82
Left = 83
Top = 96
Width = 121
Height = 13
......
......@@ -64,7 +64,7 @@ bool ControlPlay( TObject *Sender )
vlc_object_find( p_intfGlobal, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist == NULL )
{
p_intfGlobal->p_sys->p_window->MenuOpenFileClick( Sender );
p_intfGlobal->p_sys->p_window->OpenFileActionExecute( Sender );
return false;
}
......@@ -79,7 +79,7 @@ bool ControlPlay( TObject *Sender )
{
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
p_intfGlobal->p_sys->p_window->MenuOpenFileClick( Sender );
p_intfGlobal->p_sys->p_window->OpenFileActionExecute( Sender );
}
return true;
......
......@@ -46,14 +46,12 @@ __fastcall TDiscDlg::TDiscDlg( TComponent* Owner )
//---------------------------------------------------------------------------
void __fastcall TDiscDlg::FormShow( TObject *Sender )
{
p_intfGlobal->p_sys->p_window->MenuOpenDisc->Checked = true;
p_intfGlobal->p_sys->p_window->PopupOpenDisc->Checked = true;
p_intfGlobal->p_sys->p_window->OpenDiscAction->Checked = true;
}
//---------------------------------------------------------------------------
void __fastcall TDiscDlg::FormHide( TObject *Sender )
{
p_intfGlobal->p_sys->p_window->MenuOpenDisc->Checked = false;
p_intfGlobal->p_sys->p_window->PopupOpenDisc->Checked = false;
p_intfGlobal->p_sys->p_window->OpenDiscAction->Checked = false;
}
//---------------------------------------------------------------------------
void __fastcall TDiscDlg::BitBtnCancelClick( TObject *Sender )
......
This diff is collapsed.
This diff is collapsed.
......@@ -36,6 +36,7 @@
#include <AppEvnts.hpp>
#include <ExtCtrls.hpp>
#include "CSPIN.h"
#include <ActnList.hpp>
//---------------------------------------------------------------------------
class TMainFrameDlg : public TForm
{
......@@ -72,7 +73,6 @@ __published: // IDE-managed Components
TMenuItem *MenuAngle;
TMenuItem *N3;
TMenuItem *MenuPlaylist;
TMenuItem *MenuModules;
TMenuItem *MenuMessages;
TMenuItem *MenuSettings;
TMenuItem *MenuAudio;
......@@ -90,10 +90,8 @@ __published: // IDE-managed Components
TMenuItem *PopupBack;
TMenuItem *PopupSlow;
TMenuItem *PopupFast;
TMenuItem *N5;
TMenuItem *PopupToggleInterface;
TMenuItem *PopupFullscreen;
TMenuItem *N6;
TMenuItem *PopupNext;
TMenuItem *PopupPrev;
TMenuItem *PopupJump;
......@@ -135,56 +133,64 @@ __published: // IDE-managed Components
TMenuItem *PopupClose;
TMenuItem *N9;
TCSpinEdit *SpinEditChannel;
TToolButton *ToolButton1;
TToolButton *ToolButton1;
TActionList *ActionList1;
TAction *OpenFileAction;
TAction *OpenDiscAction;
TAction *NetworkStreamAction;
TAction *PlayAction;
TAction *PauseAction;
TAction *StopAction;
TAction *EjectAction;
TAction *SlowAction;
TAction *FastAction;
TAction *PreviousAction;
TAction *NextAction;
TAction *BackAction;
TAction *PlaylistAction;
TAction *ExitAction;
TAction *FullscreenAction;
TAction *PreferencesAction;
TAction *MessagesAction;
TAction *AboutAction;
TMenuItem *Control1;
TMenuItem *N5;
TMenuItem *N6;
TMenuItem *N10;
TAction *PrevTitleAction;
TAction *NextTitleAction;
TAction *PrevChapterAction;
TAction *NextChapterAction;
void __fastcall TimerManageTimer( TObject *Sender );
void __fastcall TrackBarChange( TObject *Sender );
void __fastcall FormClose( TObject *Sender, TCloseAction &Action );
void __fastcall MenuOpenFileClick( TObject *Sender );
void __fastcall MenuOpenDiscClick( TObject *Sender );
void __fastcall MenuNetworkStreamClick( TObject *Sender );
void __fastcall MenuExitClick( TObject *Sender );
void __fastcall MenuHideinterfaceClick( TObject *Sender );
void __fastcall MenuFullscreenClick( TObject *Sender );
void __fastcall MenuPlaylistClick( TObject *Sender );
void __fastcall MenuMessagesClick( TObject *Sender );
void __fastcall MenuPreferencesClick( TObject *Sender );
void __fastcall MenuAboutClick( TObject *Sender );
void __fastcall ToolButtonFileClick( TObject *Sender );
void __fastcall ToolButtonDiscClick( TObject *Sender );
void __fastcall ToolButtonNetClick( TObject *Sender );
void __fastcall ToolButtonPlaylistClick( TObject *Sender );
void __fastcall ToolButtonBackClick( TObject *Sender );
void __fastcall ToolButtonStopClick( TObject *Sender );
void __fastcall ToolButtonPlayClick( TObject *Sender );
void __fastcall ToolButtonPauseClick( TObject *Sender );
void __fastcall ToolButtonSlowClick( TObject *Sender );
void __fastcall ToolButtonFastClick( TObject *Sender );
void __fastcall ToolButtonPrevClick( TObject *Sender );
void __fastcall ToolButtonNextClick( TObject *Sender );
void __fastcall ToolButtonEjectClick( TObject *Sender );
void __fastcall PopupCloseClick( TObject *Sender );
void __fastcall PopupPlayClick( TObject *Sender );
void __fastcall PopupPauseClick( TObject *Sender );
void __fastcall PopupStopClick( TObject *Sender );
void __fastcall PopupBackClick( TObject *Sender );
void __fastcall PopupSlowClick( TObject *Sender );
void __fastcall PopupFastClick( TObject *Sender );
void __fastcall PopupToggleInterfaceClick( TObject *Sender );
void __fastcall PopupFullscreenClick( TObject *Sender );
void __fastcall PopupNextClick( TObject *Sender );
void __fastcall PopupPrevClick( TObject *Sender );
void __fastcall PopupJumpClick( TObject *Sender );
void __fastcall PopupPlaylistClick( TObject *Sender );
void __fastcall PopupPreferencesClick( TObject *Sender );
void __fastcall PopupExitClick( TObject *Sender );
void __fastcall PopupOpenFileClick( TObject *Sender );
void __fastcall PopupOpenDiscClick( TObject *Sender );
void __fastcall PopupNetworkStreamClick( TObject *Sender );
void __fastcall ButtonTitlePrevClick( TObject *Sender );
void __fastcall ButtonTitleNextClick( TObject *Sender );
void __fastcall ButtonChapterPrevClick( TObject *Sender );
void __fastcall ButtonChapterNextClick( TObject *Sender );
void __fastcall ButtonGoClick( TObject *Sender );
void __fastcall OpenFileActionExecute( TObject *Sender );
void __fastcall OpenDiscActionExecute( TObject *Sender );
void __fastcall NetworkStreamActionExecute( TObject *Sender );
void __fastcall BackActionExecute( TObject *Sender );
void __fastcall PlayActionExecute( TObject *Sender );
void __fastcall PauseActionExecute( TObject *Sender );
void __fastcall StopActionExecute( TObject *Sender );
void __fastcall SlowActionExecute( TObject *Sender );
void __fastcall FastActionExecute( TObject *Sender );
void __fastcall PlaylistActionExecute( TObject *Sender );
void __fastcall ExitActionExecute( TObject *Sender );
void __fastcall PreviousActionExecute( TObject *Sender );
void __fastcall NextActionExecute( TObject *Sender );
void __fastcall FullscreenActionExecute( TObject *Sender );
void __fastcall PreferencesActionExecute( TObject *Sender );
void __fastcall MessagesActionExecute( TObject *Sender );
void __fastcall AboutActionExecute( TObject *Sender );
void __fastcall EjectActionExecute( TObject *Sender );
void __fastcall PrevTitleActionExecute( TObject *Sender );
void __fastcall NextTitleActionExecute( TObject *Sender );
void __fastcall PrevChapterActionExecute( TObject *Sender );
void __fastcall NextChapterActionExecute( TObject *Sender );
private: // User declarations
public: // User declarations
TStringList *StringListPref; /* stores config dialogs */
......
......@@ -49,12 +49,12 @@ void __fastcall TMessagesDlg::ButtonOKClick( TObject *Sender )
//---------------------------------------------------------------------------
void __fastcall TMessagesDlg::FormHide( TObject *Sender )
{
p_intfGlobal->p_sys->p_window->MenuMessages->Checked = false;
p_intfGlobal->p_sys->p_window->MessagesAction->Checked = false;
}
//---------------------------------------------------------------------------
void __fastcall TMessagesDlg::FormShow( TObject *Sender )
{
p_intfGlobal->p_sys->p_window->MenuMessages->Checked = true;
p_intfGlobal->p_sys->p_window->MessagesAction->Checked = true;
}
//---------------------------------------------------------------------------
void __fastcall TMessagesDlg::UpdateLog()
......@@ -80,10 +80,10 @@ void __fastcall TMessagesDlg::UpdateLog()
RichEditMessages->SelAttributes->Color = clRed;
break;
case VLC_MSG_WARN:
RichEditMessages->SelAttributes->Color = clBlack;
RichEditMessages->SelAttributes->Color = clBlue;
break;
default:
RichEditMessages->SelAttributes->Color = clBlue;
RichEditMessages->SelAttributes->Color = clBlack;
break;
}
......
......@@ -69,14 +69,12 @@ __fastcall TNetworkDlg::TNetworkDlg( TComponent* Owner )
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::FormShow( TObject *Sender )
{
p_intfGlobal->p_sys->p_window->MenuNetworkStream->Checked = true;
p_intfGlobal->p_sys->p_window->PopupNetworkStream->Checked = true;
p_intfGlobal->p_sys->p_window->NetworkStreamAction->Checked = true;
}
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::FormHide( TObject *Sender )
{
p_intfGlobal->p_sys->p_window->MenuNetworkStream->Checked = false;
p_intfGlobal->p_sys->p_window->PopupNetworkStream->Checked = false;
p_intfGlobal->p_sys->p_window->NetworkStreamAction->Checked = false;
}
//---------------------------------------------------------------------------
void __fastcall TNetworkDlg::BitBtnCancelClick( TObject *Sender )
......
......@@ -68,16 +68,12 @@ char * __fastcall TPlaylistDlg::rindex( char *s, char c )
****************************************************************************/
void __fastcall TPlaylistDlg::FormShow( TObject *Sender )
{
p_intfGlobal->p_sys->p_window->MenuPlaylist->Checked = true;
p_intfGlobal->p_sys->p_window->PopupPlaylist->Checked = true;
p_intfGlobal->p_sys->p_window->ToolButtonPlaylist->Down = true;
p_intfGlobal->p_sys->p_window->PlaylistAction->Checked = true;
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::FormHide( TObject *Sender )
{
p_intfGlobal->p_sys->p_window->MenuPlaylist->Checked = false;
p_intfGlobal->p_sys->p_window->PopupPlaylist->Checked = false;
p_intfGlobal->p_sys->p_window->ToolButtonPlaylist->Down = false;
p_intfGlobal->p_sys->p_window->PlaylistAction->Checked = false;
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::BitBtnOkClick( TObject *Sender )
......@@ -85,7 +81,7 @@ void __fastcall TPlaylistDlg::BitBtnOkClick( TObject *Sender )
Hide();
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::ListViewPlaylistDblClick( TObject *Sender )
void __fastcall TPlaylistDlg::PlayStreamActionExecute( TObject *Sender )
{
TListItem *Item;
TListItem *ItemStart;
......@@ -125,13 +121,13 @@ void __fastcall TPlaylistDlg::ListViewPlaylistKeyDown( TObject *Sender,
/* 'suppr' or 'backspace' */
if( ( Key == VK_DELETE ) || ( Key == VK_BACK ) )
{
MenuDeleteSelectedClick( Sender );
DeleteSelectionActionExecute( Sender );
}
/* 'enter' */
if( Key == VK_RETURN )
{
PopupPlayClick( Sender );
PlayStreamActionExecute( Sender );
}
}
//---------------------------------------------------------------------------
......@@ -157,21 +153,21 @@ void __fastcall TPlaylistDlg::ListViewPlaylistCustomDrawItem(
/*****************************************************************************
* Menu callbacks
* Menu and popup callbacks
****************************************************************************/
void __fastcall TPlaylistDlg::MenuAddFileClick( TObject *Sender )
{
p_intfGlobal->p_sys->p_window->MenuOpenFileClick( Sender );
p_intfGlobal->p_sys->p_window->OpenFileActionExecute( Sender );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuAddDiscClick( TObject *Sender )
{
p_intfGlobal->p_sys->p_window->MenuOpenDiscClick( Sender );
p_intfGlobal->p_sys->p_window->OpenDiscActionExecute( Sender );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuAddNetClick( TObject *Sender )
{
p_intfGlobal->p_sys->p_window->MenuNetworkStreamClick( Sender );
p_intfGlobal->p_sys->p_window->NetworkStreamActionExecute( Sender );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuAddUrlClick( TObject *Sender )
......@@ -179,7 +175,7 @@ void __fastcall TPlaylistDlg::MenuAddUrlClick( TObject *Sender )
/* TODO */
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuDeleteSelectedClick( TObject *Sender )
void __fastcall TPlaylistDlg::DeleteSelectionActionExecute( TObject *Sender )
{
#if 0 /* PLAYLIST TARASS */
/* user wants to delete a file in the queue */
......@@ -205,7 +201,7 @@ void __fastcall TPlaylistDlg::MenuDeleteSelectedClick( TObject *Sender )
#endif
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuDeleteAllClick( TObject *Sender )
void __fastcall TPlaylistDlg::DeleteAllActionExecute( TObject *Sender )
{
#if 0 /* PLAYLIST TARASS */
int i_pos;
......@@ -227,7 +223,7 @@ void __fastcall TPlaylistDlg::MenuDeleteAllClick( TObject *Sender )
#endif
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuSelectionInvertClick( TObject *Sender )
void __fastcall TPlaylistDlg::InvertSelectionActionExecute( TObject *Sender )
{
#if 0 /* PLAYLIST TARASS */
#define NOT( var ) ( (var) ? false : true )
......@@ -244,40 +240,10 @@ void __fastcall TPlaylistDlg::MenuSelectionInvertClick( TObject *Sender )
#endif
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::MenuSelectionCropClick( TObject *Sender )
void __fastcall TPlaylistDlg::CropSelectionActionExecute( TObject *Sender )
{
MenuSelectionInvertClick( Sender );
MenuDeleteSelectedClick( Sender );
}
//---------------------------------------------------------------------------
/*****************************************************************************
* Popup callbacks
****************************************************************************/
void __fastcall TPlaylistDlg::PopupPlayClick( TObject *Sender )
{
ListViewPlaylistDblClick( Sender );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::PopupInvertSelectionClick( TObject *Sender )
{
MenuSelectionInvertClick( Sender );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::PopupCropSelectionClick( TObject *Sender )
{
MenuSelectionCropClick( Sender );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::PopupDeleteSelectedClick( TObject *Sender )
{
MenuDeleteSelectedClick( Sender );
}
//---------------------------------------------------------------------------
void __fastcall TPlaylistDlg::PopupDeleteAllClick( TObject *Sender )
{
MenuDeleteAllClick( Sender );
InvertSelectionActionExecute( Sender );
DeleteSelectionActionExecute( Sender );
}
//---------------------------------------------------------------------------
......
object PlaylistDlg: TPlaylistDlg
Left = 447
Top = 197
Left = 162
Top = 364
Width = 335
Height = 436
Caption = 'Playlist'
......@@ -51,11 +51,11 @@ object PlaylistDlg: TPlaylistDlg
TabOrder = 1
ViewStyle = vsReport
OnCustomDrawItem = ListViewPlaylistCustomDrawItem
OnDblClick = ListViewPlaylistDblClick
OnDblClick = PlayStreamActionExecute
OnKeyDown = ListViewPlaylistKeyDown
end
object MainMenuPlaylist: TMainMenu
Left = 24
Left = 8
Top = 352
object MenuAdd: TMenuItem
Caption = '&Add'
......@@ -80,54 +80,79 @@ object PlaylistDlg: TPlaylistDlg
object MenuDelete: TMenuItem
Caption = '&Delete'
object MenuDeleteAll: TMenuItem
Caption = '&All'
OnClick = MenuDeleteAllClick
Action = DeleteAllAction
end
object MenuDeleteSelected: TMenuItem
Caption = '&Selected'
OnClick = MenuDeleteSelectedClick
Action = DeleteSelectionAction
Caption = '&Selection'
end
end
object MenuSelection: TMenuItem
Caption = '&Selection'
object MenuSelectionCrop: TMenuItem
Caption = '&Crop'
OnClick = MenuSelectionCropClick
Action = CropSelectionAction
end
object MenuSelectionInvert: TMenuItem
Caption = '&Invert'
OnClick = MenuSelectionInvertClick
Action = InvertSelectionAction
end
end
end
object PopupMenuPlaylist: TPopupMenu
Left = 272
Left = 40
Top = 352
object PopupPlay: TMenuItem
Caption = '&Play'
OnClick = PopupPlayClick
Action = PlayStreamAction
end
object N1: TMenuItem
Caption = '-'
end
object PopupInvertSelection: TMenuItem
Action = InvertSelectionAction
Caption = '&Invert selection'
OnClick = PopupInvertSelectionClick
end
object PopupCropSelection: TMenuItem
Action = CropSelectionAction
Caption = '&Crop selection'
OnClick = PopupCropSelectionClick
end
object N2: TMenuItem
Caption = '-'
end
object PopupDeleteSelected: TMenuItem
Caption = '&Delete selected'
OnClick = PopupDeleteSelectedClick
Action = DeleteSelectionAction
Caption = '&Delete selection'
end
object PopupDeleteAll: TMenuItem
Action = DeleteAllAction
Caption = 'Delete &all'
OnClick = PopupDeleteAllClick
end
end
object ActionList1: TActionList
Left = 264
Top = 352
object InvertSelectionAction: TAction
Caption = 'Invert'
Hint = 'Invert selection'
OnExecute = InvertSelectionActionExecute
end
object CropSelectionAction: TAction
Caption = 'Crop'
Hint = 'Crop selection'
OnExecute = CropSelectionActionExecute
end
object DeleteSelectionAction: TAction
Caption = 'Delete'
Hint = 'Delete selection'
OnExecute = DeleteSelectionActionExecute
end
object DeleteAllAction: TAction
Caption = 'All'
Hint = 'Delete all items'
OnExecute = DeleteAllActionExecute
end
object PlayStreamAction: TAction
Caption = 'Play'
Hint = 'Play the selected stream'
OnExecute = PlayStreamActionExecute
end
end
end
......@@ -31,6 +31,7 @@
#include <Menus.hpp>
#include <Grids.hpp>
#include <ComCtrls.hpp>
#include <ActnList.hpp>
//---------------------------------------------------------------------------
class TPlaylistDlg : public TForm
......@@ -58,10 +59,15 @@ __published: // IDE-managed Components
TMenuItem *N2;
TMenuItem *PopupInvertSelection;
TMenuItem *PopupCropSelection;
TActionList *ActionList1;
TAction *InvertSelectionAction;
TAction *CropSelectionAction;
TAction *DeleteSelectionAction;
TAction *DeleteAllAction;
TAction *PlayStreamAction;
void __fastcall FormShow( TObject *Sender );
void __fastcall FormHide( TObject *Sender );
void __fastcall BitBtnOkClick( TObject *Sender );
void __fastcall ListViewPlaylistDblClick( TObject *Sender );
void __fastcall ListViewPlaylistKeyDown( TObject *Sender, WORD &Key,
TShiftState Shift );
void __fastcall ListViewPlaylistCustomDrawItem( TCustomListView *Sender,
......@@ -70,15 +76,11 @@ __published: // IDE-managed Components
void __fastcall MenuAddDiscClick( TObject *Sender );
void __fastcall MenuAddNetClick( TObject *Sender );
void __fastcall MenuAddUrlClick( TObject *Sender );
void __fastcall MenuDeleteSelectedClick( TObject *Sender );
void __fastcall MenuDeleteAllClick( TObject *Sender );
void __fastcall MenuSelectionInvertClick( TObject *Sender );
void __fastcall MenuSelectionCropClick( TObject *Sender );
void __fastcall PopupPlayClick( TObject *Sender );
void __fastcall PopupInvertSelectionClick( TObject *Sender );
void __fastcall PopupCropSelectionClick( TObject *Sender );
void __fastcall PopupDeleteSelectedClick( TObject *Sender );
void __fastcall PopupDeleteAllClick( TObject *Sender );
void __fastcall InvertSelectionActionExecute( TObject *Sender );
void __fastcall CropSelectionActionExecute( TObject *Sender );
void __fastcall DeleteSelectionActionExecute( TObject *Sender );
void __fastcall DeleteAllActionExecute( TObject *Sender );
void __fastcall PlayStreamActionExecute( TObject *Sender );
private: // User declarations
char * __fastcall rindex( char *s, char c );
public: // User declarations
......
......@@ -334,16 +334,14 @@ void __fastcall TPreferencesDlg::FormClose( TObject *Sender,
void __fastcall TPreferencesDlg::FormShow( TObject *Sender )
{
/*
p_intfGlobal->p_sys->p_window->MenuPreferences->Checked = true;
p_intfGlobal->p_sys->p_window->PopupPreferences->Checked = true;
p_intfGlobal->p_sys->p_window->PreferencesAction->Checked = true;
*/
}
//---------------------------------------------------------------------------
void __fastcall TPreferencesDlg::FormHide( TObject *Sender )
{
/*
p_intfGlobal->p_sys->p_window->MenuPreferences->Checked = false;
p_intfGlobal->p_sys->p_window->PopupPreferences->Checked = false;
p_intfGlobal->p_sys->p_window->PreferencesAction->Checked = false;
*/
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment