Implemented shortcuts for starting programs (#391)
parent
f3dd6ec55e
commit
23c734c3c1
|
@ -247,6 +247,54 @@ bool CBrain::EventProcess(const Event &event)
|
|||
action = event.type;
|
||||
}
|
||||
|
||||
if(event.type == EVENT_KEY_DOWN && m_object->GetSelect())
|
||||
{
|
||||
bool bControl = (event.kmodState & KEY_MOD(CTRL)) != 0;
|
||||
bool bAlt = (event.kmodState & KEY_MOD(ALT)) != 0;
|
||||
CEventQueue* queue = CApplication::GetInstancePointer()->GetEventQueue();
|
||||
|
||||
if(event.key.slot == INPUT_SLOT_ACTION && bControl)
|
||||
{
|
||||
Event newEvent = event;
|
||||
newEvent.type = (m_studio == nullptr ? EVENT_OBJECT_PROGEDIT : EVENT_STUDIO_OK);
|
||||
queue->AddEvent(newEvent);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(event.key.slot == INPUT_SLOT_ACTION && bAlt)
|
||||
{
|
||||
Event newEvent = event;
|
||||
newEvent.type = EVENT_OBJECT_PROGRUN;
|
||||
queue->AddEvent(newEvent);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(bAlt)
|
||||
{
|
||||
int index = GetSelScript();
|
||||
if(event.key.slot == INPUT_SLOT_UP)
|
||||
index--;
|
||||
else if(event.key.slot == INPUT_SLOT_DOWN)
|
||||
index++;
|
||||
else if(event.key.key >= KEY(1) && event.key.key <= KEY(9))
|
||||
index = event.key.key-KEY(1);
|
||||
else if(event.key.key == KEY(0))
|
||||
index = 9;
|
||||
if(index < 0) index = 9;
|
||||
if(index > 9) index = 0;
|
||||
|
||||
if(GetSelScript() != index)
|
||||
{
|
||||
SetSelScript(index);
|
||||
|
||||
Event newEvent = event;
|
||||
newEvent.type = EVENT_OBJECT_PROGLIST;
|
||||
queue->AddEvent(newEvent);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( action == EVENT_NULL ) return true;
|
||||
|
||||
if ( action == EVENT_UPDINTERFACE )
|
||||
|
@ -2463,6 +2511,23 @@ int CBrain::GetSelScript()
|
|||
return pl->GetSelect();
|
||||
}
|
||||
|
||||
// Changes selected script
|
||||
|
||||
void CBrain::SetSelScript(int index)
|
||||
{
|
||||
Ui::CWindow* pw;
|
||||
Ui::CList* pl;
|
||||
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return;
|
||||
|
||||
pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_PROGLIST));
|
||||
if ( pl == 0 ) return;
|
||||
|
||||
pl->SetSelect(index);
|
||||
pl->ShowSelect(true);
|
||||
}
|
||||
|
||||
// Blinks the running program.
|
||||
|
||||
void CBrain::BlinkScript(bool bEnable)
|
||||
|
|
|
@ -159,6 +159,7 @@ protected:
|
|||
|
||||
void UpdateScript(Ui::CWindow *pw);
|
||||
int GetSelScript();
|
||||
void SetSelScript(int index);
|
||||
void BlinkScript(bool bEnable);
|
||||
|
||||
void CheckInterface(Ui::CWindow *pw, EventType event, bool bState);
|
||||
|
|
|
@ -125,17 +125,6 @@ bool CStudio::EventProcess(const Event &event)
|
|||
newEvent.type = EVENT_STUDIO_OK;
|
||||
m_event->AddEvent(newEvent);
|
||||
}
|
||||
|
||||
if ( event.type == EVENT_KEY_DOWN )
|
||||
{
|
||||
if ( event.key.slot == INPUT_SLOT_ACTION &&
|
||||
(event.kmodState & KEY_MOD(CTRL)) != 0 )
|
||||
{
|
||||
Event newEvent = event;
|
||||
newEvent.type = EVENT_STUDIO_OK;
|
||||
m_event->AddEvent(newEvent);
|
||||
}
|
||||
}
|
||||
|
||||
if ( event.type == EVENT_STUDIO_EDIT ) // text modifief?
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue