Esempio n. 1
0
void MainWindow::InitWindow()
{
    // Get drag & drop system and drag/drop controllers
    CGui::DragDropSystem& clDragDropSystem = CGui::DragDropSystem::GetInstance();

    // Get and setup drag objects
    CGui::PanelPtr pPnlDrop1 = GetPanel( "PnlDrop1" );
    if ( pPnlDrop1 != NULL )
    {
        clDragDropSystem.SetDropController( pPnlDrop1, CGui::DropControllerPtr( new CGui::FreeDropController() ) );
        for ( Unsigned32 u32ChildIdx = 0; u32ChildIdx < pPnlDrop1->GetNumChildren(); ++u32ChildIdx )
        {
            CGui::GuiObjectPtr pChild = pPnlDrop1->GetChild( u32ChildIdx );
            pChild->SetDraggable( true );
            clDragDropSystem.SetDragController( pChild, CGui::DragControllerPtr( new CGui::FreeDragController() ) );
        }
    }
    CGui::PanelPtr pPnlDrop2 = GetPanel( "PnlDrop2" );
    if ( pPnlDrop1 != NULL )
    {
        clDragDropSystem.SetDropController( pPnlDrop2, CGui::DropControllerPtr( new CGui::FreeDropController() ) );
    }

    // Setup trash can
    CGui::GuiObjectPtr pTrashCan = GetGuiObject( "ImgTrashCan" );
    if ( pTrashCan != NULL )
    {
        clDragDropSystem.SetDropController( pTrashCan, CGui::DropControllerPtr( new TrashDropController() ) );
    }
}
Esempio n. 2
0
void Hotlist::OnLayout(BOOL compute_size_only, INT32 available_width, INT32 available_height, INT32& used_width, INT32& used_height)
{
	if (!m_selector)
		return;

	used_width = available_width;
	used_height = available_height;

	if (GetCollapse() == COLLAPSE_SMALL)
	{
		used_width = m_selector->GetWidthFromHeight(available_height);
	}

	if (compute_size_only)
		return;

	OpRect rect(0, 0, available_width, available_height);

	rect = m_selector->LayoutToAvailableRect(rect);
	rect = m_header_toolbar->LayoutToAvailableRect(rect);

	for (INT32 i = 0; i < GetPanelCount(); i++)
	{
		GetPanel(i)->SetRect(rect);
	}
}
Esempio n. 3
0
LONG CNetworkMonitorBox::OnTimerOut(WPARAM wParam, LPARAM lParam)
{
	m_wndClock.SetStyle( CEDClock::EClockStyle::XDC_FLOWNEXT );
	GetPanel()->GetParent()->PostMessage( ID_TAB_CONNECT );
	
	return 0;
}
Esempio n. 4
0
void Hotlist::OnDragStart(OpWidget* widget, INT32 pos, INT32 x, INT32 y)
{
	if (widget == m_selector && g_application->IsDragCustomizingAllowed())
	{
		HotlistPanel* panel = GetPanel(pos);
		if (!panel)
			return;

		DesktopDragObject* drag_object = m_selector->GetWidget(pos)->GetDragObject(panel->GetType() == PANEL_TYPE_WEB ? DRAG_TYPE_BOOKMARK : panel->GetType(), x, y);

		if (drag_object)
		{
			if (panel->GetType() == PANEL_TYPE_WEB)
			{
				HotlistManager::ItemData item_data;
				HotlistModelItem* item = g_hotlist_manager->GetItemByID(panel->GetID());
				if (item->GetModel() && item->GetModel()->GetModelType() == HotlistModel::BookmarkRoot && item->IsFolder())
					return;

				if( !g_hotlist_manager->GetItemValue(panel->GetID(), item_data ))
				{
					return;
				}
				else
				{
					drag_object->AddID(panel->GetID());
					drag_object->SetURL(item_data.url.CStr());
					drag_object->SetTitle(item_data.name.CStr());
				}
			}
			g_drag_manager->StartDrag(drag_object, NULL, FALSE);
		}
	}
}
Esempio n. 5
0
void Hotlist::RemovePanel(INT32 index)
{
	if (m_selector->GetSelected() == index)
		m_selector->SetSelected(-1, TRUE);

	GetPanel(index)->Delete();
	m_selector->RemoveWidget(index);
}
Esempio n. 6
0
void Hotlist::GetPanelText(INT32 index, OpString& text, PanelTextType text_type)
{
	HotlistPanel* panel = GetPanel(index);

	if (!panel)
		return;

	panel->GetPanelText(text, text_type);
}
Esempio n. 7
0
HotlistPanel* Hotlist::PositionPanel(Type panel_type, INT32 pos)
{
	OP_ASSERT(panel_type != PANEL_TYPE_WEB);	//this function current does not support
	                                            // web panels (because they can have multiple instances)

	Type current_panel_type = OpTypedObject::UNKNOWN_TYPE;

	//get current panel on target position
	HotlistPanel* current_panel = GetPanel(pos);

	if (current_panel)
	{
		current_panel_type = current_panel->GetType();
	}

	if (panel_type == current_panel_type)
	{
		//same panel is already there, do nothing
		return current_panel;
	}

	//If the position is not defined, set it on default as last
	if (pos < 0)
	{
		pos = GetPanelCount();
	}

	//Look if this type of panel is already there
	INT32	dub_pos;
	HotlistPanel* same_panel = GetPanelByType(panel_type, &dub_pos);
	if (same_panel)
	{
		//this type of panel is already somewhere else, let's move it to new position
		MovePanel(dub_pos, pos);
		return same_panel;
	}

	//A panel of panel_type currently doesn't exists -> add a new panel to the desired position
	AddPanelByType(panel_type, pos);

	return GetPanel(pos);
}
Esempio n. 8
0
BOOL Hotlist::ChangeItem(OpTreeModel* model, INT32 model_pos)
{
	if( !model )
	{
		return FALSE;
	}

	OpTreeModelItem* model_item = model->GetItemByPosition(model_pos);

	if( !model_item )
	{
		return FALSE;
	}

	INT32 pos = FindItem(model_item->GetID());

	if (pos == -1)
	{
		return AddItem(model, model_pos);
	}

	// if pos is not -1, that is, if the item is in panels, remoe if neccessary
	HotlistManager::ItemData item_data;
	g_hotlist_manager->GetItemValue( model_item, item_data );
	if( item_data.panel_position == -1 )
	{
		return RemoveItem(model, model_pos);
	}

	// This Panel is already in panels (m_widgets) and should be there

	m_selector->GetWidget(pos)->SetText(item_data.name.CStr());

	// Move the panel to the position given in bookmarks model
	m_selector->MoveWidget(pos, item_data.panel_position);


	for (INT32 i = 0; i < GetPanelCount(); i++)
	{
		HotlistPanel* panel = GetPanel(i);
		if (panel->GetType() == PANEL_TYPE_WEB
			&& model_item->GetID() == panel->GetID())
		{
			panel->UpdateSettings();
			return TRUE;
		}
	}

	return TRUE;
}
Esempio n. 9
0
INT32 Hotlist::FindItem(INT32 id)
{
	for (INT32 i = 0; i < GetPanelCount(); i++)
	{
		HotlistPanel* panel = GetPanel(i);

		if (panel->GetType() == PANEL_TYPE_WEB && id == panel->GetID())
		{
			return i;
		}
	}

	return -1;
}
Esempio n. 10
0
void CSearchInputBox::OnSearchStop()
{
	CString strCaption, strTest;
	
	LoadString( strTest, IDS_SEARCH_PANEL_CLEAR );
	m_wndStop.GetWindowText( strCaption );
	
	CWnd* pTarget = GetPanel()->GetParent();
	
	if ( strCaption == strTest )
		pTarget->PostMessage( WM_COMMAND, ID_SEARCH_CLEAR );
	else
		pTarget->PostMessage( WM_COMMAND, ID_SEARCH_STOP );
}
Esempio n. 11
0
HotlistPanel* Hotlist::GetPanelByType(OpTreeModelItem::Type type, INT32* index)
{
	if (!m_selector)
		return NULL;

	for (INT32 i = 0; i < GetPanelCount(); i++)
	{
		if (GetPanel(i)->GetType() == type)
		{
			if (index)
			{
				*index = i;
			}
			return GetPanel(i);
		}
	}

	if (index)
	{
		*index = -1;
	}
	return NULL;
}
Esempio n. 12
0
INT32 Hotlist::FindItem(OpString guid)
{
	for (INT32 i = 0; i < GetPanelCount(); i++)
	{
		HotlistPanel* panel = GetPanel(i);

		if (panel->GetType() == PANEL_TYPE_WEB && guid.CompareI(((WebPanel*)panel)->GetGuid()) == 0)
		{
			return i;
		}
	}

	return -1;

}
Esempio n. 13
0
void Hotlist::SaveActiveTab(UINT index)
{
	HotlistPanel* panel = GetPanel(index);
	if (panel)
	{
		if (panel->GetType() == PANEL_TYPE_WEB)
		{
			TRAPD(err, g_pcui->WriteStringL(PrefsCollectionUI::HotlistActiveTab, ((WebPanel*)panel)->GetGuid()));
		}
		else
		{
			OpString panel_name;
			panel_name.Set(GetPanelNameByType(panel->GetType()));
			TRAPD(err, g_pcui->WriteStringL(PrefsCollectionUI::HotlistActiveTab, panel_name));
		}
	}
}
Esempio n. 14
0
void Hotlist::OnWritePanels(PrefsFile* prefs_file, const char* name)
{
	for (INT32 i = 0; i < GetPanelCount(); i++)
	{
		HotlistPanel* panel = GetPanel(i);

		if (panel->GetType() == PANEL_TYPE_WEB)
		{
			g_hotlist_manager->SetPanelPosition( panel->GetID(), i, FALSE );
		}
		else
		{
			OpLineString key;
			OpString name_str;

			key.WriteToken8(GetPanelNameByType(panel->GetType()));
			key.WriteValue(i, FALSE);

			name_str.Set(name);
			prefs_file->WriteStringL(name_str.CStr(), key.GetString(), NULL);
		}
	}
}
Esempio n. 15
0
void CBattleJiki::CPreBattle(){
	
	if(stopf==true){


		if(max_dx>-2){
			max_dx-=0.72;
		}

		for(int x=0 ;x<max_dx ;x++){
				for(int y=0 ;y<max_dy ;y++){
					DrawGraph(800 - x*40 ,y*40,GetPanel(),true);
				}
			}


		if(max_dx<0 ){
		stopf=false;
		}
	
	}


}
Esempio n. 16
0
void CSearchInputBox::OnSelChangeSchemas()
{
	CSearchPanel* pPanel = (CSearchPanel*)GetPanel();
	pPanel->OnSchemaChange();
}
Esempio n. 17
0
void MainWidget::RunLocalMacros(RDMacro *rml)
{
  QString str;
  QString logname;
  RDAirPlayConf::PanelType panel_type;
  int panel_number;
  QString sql;
  QPalette pal;
  bool ret=false;
  int fade;
  RDLogLine *logline=NULL;
  QString label;
  int mach=0;

  if(rml->role()!=RDMacro::Cmd) {
    return;
  }

  switch(rml->command()) {
  case RDMacro::LB:     // Label
    if(rml->argQuantity()==0) {
      air_message_label->clear();
    }
    else {
      for(int i=0;i<(rml->argQuantity()-1);i++) {
	str+=(rml->arg(i).toString()+" ");
      }
      str+=rml->arg(rml->argQuantity()-1).toString();
      pal=air_message_label->palette();
      pal.setColor(QPalette::Active,QColorGroup::Foreground,QColor(black));
      pal.setColor(QPalette::Inactive,QColorGroup::Foreground,
		   QColor(black));
      air_message_label->setPalette(pal);
      air_message_label->setFont(MessageFont(str));
      air_message_label->setText(str);
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::LC:     // Color Label
    if(rml->argQuantity()<=1) {
      air_message_label->clear();
    }
    else {
      QColor color(rml->arg(0).toString());
      if(!color.isValid()) {
	color=QColor(black);
      }
      for(int i=1;i<(rml->argQuantity()-1);i++) {
	str+=(rml->arg(i).toString()+" ");
      }
      str+=rml->arg(rml->argQuantity()-1).toString();
      pal=air_message_label->palette();
      pal.setColor(QPalette::Active,QColorGroup::Foreground,color);
      pal.setColor(QPalette::Inactive,QColorGroup::Foreground,color);
      air_message_label->setPalette(pal);
      air_message_label->setFont(MessageFont(str));
      air_message_label->setText(str);
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::LL:    // Load Log
    if((rml->argQuantity()<1)||(rml->argQuantity()>3)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(0).toInt()<1)||(rml->arg(0).toInt()>3)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(rml->argQuantity()==1) {   // Clear Log
      air_log[rml->arg(0).toInt()-1]->clear();
    }
    else {  // Load Log
      logname=rml->arg(1).toString();
      if(!RDLog::exists(logname)) {
	if(rml->echoRequested()) {
	  rml->acknowledge(false);
	  rdripc->sendRml(rml);
	}
	return;
      }
      air_log[rml->arg(0).toInt()-1]->setLogName(RDLog::tableName(logname));
      air_log[rml->arg(0).toInt()-1]->load();
    }
    if(rml->argQuantity()==3) { // Start Log
      if(rml->arg(2).toInt()<air_log[rml->arg(0).toInt()-1]->size()) {
	if(rml->arg(2).toInt()>=0) {  // Unconditional start
	  air_log[rml->arg(0).toInt()-1]->play(rml->arg(2).toInt(),
					       RDLogLine::StartMacro);
	}
	if(rml->arg(2).toInt()==-2) {  // Start if trans type allows
	  // Find first non-running event
	  bool found=false;
	  for(int i=0;i<air_log[rml->arg(0).toInt()-1]->size();i++) {
	    if((logline=air_log[rml->arg(0).toInt()-1]->logLine(i))!=NULL) {
	      if(logline->status()==RDLogLine::Scheduled) {
		found=true;
		i=air_log[rml->arg(0).toInt()-1]->size();
	      }
	    }
	  }
	  if(found) {
	    switch(logline->transType()) {
	    case RDLogLine::Play:
	    case RDLogLine::Segue:
	      air_log[rml->arg(0).toInt()-1]->
		play(0,RDLogLine::StartMacro);
	      break;
	      
	    case RDLogLine::Stop:
	    case RDLogLine::NoTrans:
	      break;
	    }
	  }
	}
      }
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::AL:   // Append Log
    if(rml->argQuantity()!=2) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(0).toInt()<1)||(rml->arg(0).toInt()>3)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    logname=rml->arg(1).toString();
    if(!RDLog::exists(logname)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    air_log[rml->arg(0).toInt()-1]->append(logname);
    break;

  case RDMacro::MN:    // Make Next
    if(rml->argQuantity()!=2) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(0).toInt()<1)||(rml->arg(0).toInt()>3)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(1).toInt()<0)||
       (rml->arg(1).toInt()>=air_log[rml->arg(0).toInt()-1]->size())) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    air_log[rml->arg(0).toInt()-1]->makeNext(rml->arg(1).toInt());
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::PB:   // Push Button
    if(rml->argQuantity()!=1) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(0).toInt()<1)||
       (rml->arg(0).toInt()>BUTTON_TOTAL_BUTTONS)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
	return;
      }
    }
    air_button_list->startButton(rml->arg(0).toInt()-1);
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::PC:   // Label Button
    if(rml->argQuantity()<5) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(!GetPanel(rml->arg(0).toString(),&panel_type,&panel_number)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(1).toInt()<=0)||
       (rml->arg(1).toInt()>AIR_PANEL_BUTTON_COLUMNS)||
       (rml->arg(2).toInt()<=0)||
       (rml->arg(2).toInt()>AIR_PANEL_BUTTON_ROWS)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    for(int i=3;i<(rml->argQuantity()-1);i++) {
      label+=(rml->arg(i).toString()+" ");
    }
    label=label.left(label.length()-1);
    air_panel->setText(panel_type,panel_number,rml->arg(2).toInt()-1,
		       rml->arg(1).toInt()-1,label);
    air_panel->setColor(panel_type,panel_number,rml->arg(2).toInt()-1,
			rml->arg(1).toInt()-1,
			rml->arg(rml->argQuantity()-1).toString());
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::PE:    // Load Panel Button
    if(rml->argQuantity()!=4) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(!GetPanel(rml->arg(0).toString(),&panel_type,&panel_number)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(1).toInt()<=0)||
       (rml->arg(1).toInt()>AIR_PANEL_BUTTON_COLUMNS)||
       (rml->arg(2).toInt()<=0)||
       (rml->arg(2).toInt()>AIR_PANEL_BUTTON_ROWS)||
       (rml->arg(3).toUInt()>999999)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    air_panel->setButton(panel_type,panel_number,rml->arg(2).toInt()-1,
			 rml->arg(1).toInt()-1,rml->arg(3).toUInt());
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::PL:    // Start
    if(rml->argQuantity()!=2) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(0).toInt()<1)||(rml->arg(0).toInt()>3)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(1).toInt()<0)||
       (rml->arg(1).toInt()>=air_log[rml->arg(0).toInt()-1]->size())) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(!air_log[rml->arg(0).toInt()-1]->running()) {
      if(!air_log[rml->arg(0).toInt()-1]->play(rml->arg(1).toInt(),
					       RDLogLine::StartMacro)) {
	if(rml->echoRequested()) {
	  rml->acknowledge(false);
	  rdripc->sendRml(rml);
	}
	return;
      }
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::PM:    // Set Mode
    if((rml->argQuantity()!=1)&&(rml->argQuantity()!=2)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(rml->argQuantity()==2) {
      mach=rml->arg(1).toInt();
      if((mach<0)||(mach>RDAIRPLAY_LOG_QUANTITY)) {
	if(rml->echoRequested()) {
	  rml->acknowledge(false);
	  rdripc->sendRml(rml);
	}
	return;
      }
    }
    switch((RDAirPlayConf::OpMode)rml->arg(0).toInt()) {
    case RDAirPlayConf::LiveAssist:
      SetLiveAssistMode(mach-1);
      break;

    case RDAirPlayConf::Manual:
      SetManualMode(mach-1);
      break;

    case RDAirPlayConf::Auto:
      SetAutoMode(mach-1);
      break;

    default:
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
	return;
      }
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::PN:    // Start Next
    if((rml->argQuantity()<1)||(rml->argQuantity()>3)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(0).toInt()<1)||(rml->arg(0).toInt()>3)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(rml->argQuantity()>=2) {
      if((rml->arg(1).toInt()<1)||(rml->arg(1).toInt()>2)) {
	if(rml->echoRequested()) {
	  rml->acknowledge(false);
	  rdripc->sendRml(rml);
	}
	return;
      }
      if(rml->argQuantity()==3) {
	if((rml->arg(2).toInt()<0)||(rml->arg(2).toInt()>1)) {
	  if(rml->echoRequested()) {
	    rml->acknowledge(false);
	    rdripc->sendRml(rml);
	  }
	  return;
	}
      }
    }
    if(air_log[rml->arg(0).toInt()-1]->nextLine()>=0) {
      if(rml->argQuantity()==1) {
	air_log[rml->arg(0).toInt()-1]->
	  play(air_log[rml->arg(0).toInt()-1]->nextLine(),
	       RDLogLine::StartMacro);
      }
      else {
	if(rml->argQuantity()==2) {
	  air_log[rml->arg(0).toInt()-1]->
	    play(air_log[rml->arg(0).toInt()-1]->nextLine(),
		 RDLogLine::StartMacro,rml->arg(1).toInt()-1);
	}
	else {
	  air_log[rml->arg(0).toInt()-1]->
	    play(air_log[rml->arg(0).toInt()-1]->nextLine(),
		 RDLogLine::StartMacro,
		 rml->arg(1).toInt()-1,rml->arg(2).toInt());
	}
      }
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::PP:    // Play Panel Button
    if(rml->argQuantity()<3 || rml->argQuantity()>5) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(!GetPanel(rml->arg(0).toString(),&panel_type,&panel_number)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(1).toInt()<0)||
       (rml->arg(1).toInt()>AIR_PANEL_BUTTON_COLUMNS)||
       (rml->arg(2).toInt()<0)||
       (rml->arg(2).toInt()>AIR_PANEL_BUTTON_ROWS)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    switch(rml->argQuantity()) {
    case 3:
      air_panel->play(panel_type,panel_number,rml->arg(2).toInt()-1,
		      rml->arg(1).toInt()-1,RDLogLine::StartMacro);
      break; 

    case 4:
      air_panel->play(panel_type,panel_number,rml->arg(2).toInt()-1,
		      rml->arg(1).toInt()-1,RDLogLine::StartMacro,rml->arg(3).toInt());
      break;
 
    case 5: 
      if(rml->arg(4).toInt()==1) {
	air_panel->play(panel_type,panel_number,rml->arg(2).toInt()-1,
			rml->arg(1).toInt()-1,
			RDLogLine::StartMacro,rml->arg(3).toInt(),true);
      }
      else {
	air_panel->play(panel_type,panel_number,rml->arg(2).toInt()-1,
			rml->arg(1).toInt()-1,RDLogLine::StartMacro,rml->arg(3).toInt());
      }
      break;

    default:
      break;
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::PS:    // Stop
    if(rml->argQuantity()<1 || rml->argQuantity()>3) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(0).toInt()<0)||(rml->arg(0).toInt()>3)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    fade=0;
    if(rml->argQuantity()>1) {
      fade=rml->arg(1).toInt();
    }
    switch(rml->arg(0).toInt()) {
    case 0:   // Stop All Logs
      air_log[0]->stop(true,0,fade);
      air_log[1]->stop(true,0,fade);
      air_log[2]->stop(true,0,fade);
      break;

    case 1:
    case 2:
    case 3:
      if(rml->argQuantity()==3) {
	air_log[rml->arg(0).toInt()-1]->stop(false,rml->arg(2).toInt(),fade);
      }
      else {
	air_log[rml->arg(0).toInt()-1]->stop(true,0,fade);
      }
      break;
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::MD:    // Duck Machine
    if(rml->argQuantity()<3 || rml->argQuantity()>4) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(0).toInt()<0)||(rml->arg(0).toInt()>3)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    switch(rml->arg(0).toInt()) {
    case 0:   // Duck All Logs
      air_log[0]->duckVolume(rml->arg(1).toInt()*100,rml->arg(2).toInt());
      air_log[1]->duckVolume(rml->arg(1).toInt()*100,rml->arg(2).toInt());
      air_log[2]->duckVolume(rml->arg(1).toInt()*100,rml->arg(2).toInt());
      break;

    case 1:
    case 2:
    case 3:
      if(rml->argQuantity()==3) {
	air_log[rml->arg(0).toInt()-1]->duckVolume(rml->arg(1).toInt()*100,rml->arg(2).toInt());
      }
      else {
	air_log[rml->arg(0).toInt()-1]->duckVolume(rml->arg(1).toInt()*100,
						   rml->arg(2).toInt(),rml->arg(3).toInt());
      }
      break;
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::PT:    // Stop Panel Button
    if(rml->argQuantity()<3 || rml->argQuantity()>6) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(!GetPanel(rml->arg(0).toString(),&panel_type,&panel_number)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(1).toInt()<0)||
       (rml->arg(1).toInt()>AIR_PANEL_BUTTON_COLUMNS)||
       (rml->arg(2).toInt()<0)||
       (rml->arg(2).toInt()>AIR_PANEL_BUTTON_ROWS)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    switch(rml->argQuantity()) {
    case 3: 
      air_panel->stop(panel_type,panel_number,rml->arg(2).toInt()-1,
		      rml->arg(1).toInt()-1);
      break;
  
    case 4:
      air_panel->stop(panel_type,panel_number,rml->arg(2).toInt()-1,
		      rml->arg(1).toInt()-1,rml->arg(3).toInt());
      break;

    case 5:
      if(rml->arg(4).toInt()==1) {
	air_panel->stop(panel_type,panel_number,rml->arg(2).toInt()-1,
			rml->arg(1).toInt()-1,rml->arg(3).toInt(),true);
      }
      else {
	air_panel->stop(panel_type,panel_number,rml->arg(2).toInt()-1,
			rml->arg(1).toInt()-1,rml->arg(3).toInt(),false);
      }
      break;
         
    case 6:
      if(rml->arg(4).toInt()==1) {
	air_panel->stop(panel_type,panel_number,rml->arg(2).toInt()-1,
			rml->arg(1).toInt()-1,rml->arg(3).toInt(),true,
			rml->arg(5).toInt());
      }
      else {
	air_panel->stop(panel_type,panel_number,rml->arg(2).toInt()-1,
			rml->arg(1).toInt()-1,rml->arg(3).toInt(),false,
			rml->arg(5).toInt());
      }
      break;
         
    default: 
      break;
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::PU:    // Pause Panel Button
    if(rml->argQuantity()<3 || rml->argQuantity()>4) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(!GetPanel(rml->arg(0).toString(),&panel_type,&panel_number)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(1).toInt()<0)||
       (rml->arg(1).toInt()>AIR_PANEL_BUTTON_COLUMNS)||
       (rml->arg(2).toInt()<0)||
       (rml->arg(2).toInt()>AIR_PANEL_BUTTON_ROWS)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(rml->argQuantity()==3) {
      ret=air_panel->pause(panel_type,panel_number,rml->arg(2).toInt()-1,
			   rml->arg(1).toInt()-1);
    }
    else {
      ret=air_panel->pause(panel_type,panel_number,rml->arg(2).toInt()-1,
			   rml->arg(1).toInt()-1,rml->arg(3).toInt());
    }
    if(rml->echoRequested()) {
      rml->acknowledge(ret);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::PD:    // Duck Panel Button
    if(rml->argQuantity()<5 || rml->argQuantity()>6) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(!GetPanel(rml->arg(0).toString(),&panel_type,&panel_number)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(1).toInt()<0)||
       (rml->arg(1).toInt()>AIR_PANEL_BUTTON_COLUMNS)||
       (rml->arg(2).toInt()<0)||
       (rml->arg(2).toInt()>AIR_PANEL_BUTTON_ROWS)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(rml->argQuantity()==5) {
      air_panel->duckVolume(panel_type,panel_number,rml->arg(2).toInt()-1,
			    rml->arg(1).toInt()-1,(rml->arg(3).toInt())*100,rml->arg(4).toInt());
    }
    else {
      air_panel->duckVolume(panel_type,panel_number,rml->arg(2).toInt()-1,
			    rml->arg(1).toInt()-1,(rml->arg(3).toInt())*100,rml->arg(4).toInt(),
			    rml->arg(5).toInt());
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;


  case RDMacro::PW:    // Select Widget
    if(rml->argQuantity()!=1) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(0).toInt()<0)||(rml->arg(0).toInt()>3)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    switch(rml->arg(0).toInt()) {
    case 0:  // Sound Panel
      panelButtonData();
      break;

    case 1:
    case 2:
    case 3:
      fullLogButtonData(rml->arg(0).toInt()-1);
      break;
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::PX:    // Add Next
    if(rml->argQuantity()!=2) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(0).toInt()<1)||(rml->arg(0).toInt()>3)||
       (rml->arg(1).toUInt()>999999)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(air_log[rml->arg(0).toInt()-1]->nextLine()>=0) {
      air_log[rml->arg(0).toInt()-1]->
	insert(air_log[rml->arg(0).toInt()-1]->nextLine(),
	       rml->arg(1).toUInt(),RDLogLine::Play);
    }
    else {
      air_log[rml->arg(0).toInt()-1]->
	insert(air_log[rml->arg(0).toInt()-1]->size(),
	       rml->arg(1).toUInt(),RDLogLine::Play);
      air_log[rml->arg(0).toInt()-1]->
	makeNext(air_log[rml->arg(0).toInt()-1]->size()-1);
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::RL:    // Refresh Log
    if(rml->argQuantity()!=1) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(0).toInt()<1)||(rml->arg(0).toInt()>3)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(!air_log[rml->arg(0).toInt()-1]->refresh()) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  case RDMacro::SN:    // Set default Now & Next Cart
    if(rml->argQuantity()!=3) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(0).toString().lower()!="now")&&
       (rml->arg(0).toString().lower()!="next")) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if((rml->arg(1).toInt()<1)||(rml->arg(1).toInt()>3)) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(rml->arg(2).toUInt()>999999) {
      if(rml->echoRequested()) {
	rml->acknowledge(false);
	rdripc->sendRml(rml);
      }
      return;
    }
    if(rml->arg(0).toString().lower()=="now") {
      air_log[rml->arg(1).toInt()-1]->setNowCart(rml->arg(2).toUInt());
    }
    else {
      air_log[rml->arg(1).toInt()-1]->setNextCart(rml->arg(2).toUInt());
    }
    if(rml->echoRequested()) {
      rml->acknowledge(true);
      rdripc->sendRml(rml);
    }   
    break;

  default:
    break;
  }
}
Esempio n. 18
0
BOOL Hotlist::OnInputAction(OpInputAction* action)
{
	if (!m_selector)
		return FALSE;

	if (OpBar::OnInputAction(action))
		return TRUE;

	HotlistPanel* panel = m_selector->GetFocused() != -1 ? GetPanel(m_selector->GetFocused()) : NULL;
	WebPanel* web_panel = panel && panel->GetType() == PANEL_TYPE_WEB ? (WebPanel*) panel : NULL;

	switch (action->GetAction())
	{
		case OpInputAction::ACTION_GET_ACTION_STATE:
		{
			OpInputAction* child_action = action->GetChildAction();

			switch (child_action->GetAction())
			{
				case OpInputAction::ACTION_FOCUS_PANEL:
				{
					child_action->SetEnabled(TRUE);
					child_action->SetSelected(!child_action->HasActionDataString() && m_selector->GetSelected() == child_action->GetActionData());
					return TRUE;
				}

				case OpInputAction::ACTION_EDIT_PANEL:
				{
					child_action->SetEnabled(web_panel != NULL);
					return TRUE;
				}
				case OpInputAction::ACTION_SHOW_POPUP_MENU:
				{
					if (child_action->HasActionDataString() && uni_stricmp(child_action->GetActionDataString(), UNI_L("Internal Panels")) == 0)
					{
						OpString text;
						GetPanelText(m_selector->GetSelected(), text, PANEL_TEXT_NAME);

						child_action->SetActionText(text.CStr());
						return TRUE;
					}
					return FALSE;
				}
				case OpInputAction::ACTION_ADD_WEB_PANEL:
				{
					// DSK-351304: adding a web panel creates new bookmark - disable until bookmarks are loaded
					child_action->SetEnabled(g_desktop_bookmark_manager->GetBookmarkModel()->Loaded());
					return TRUE;
				}
			}
			break;
		}

		case OpInputAction::ACTION_GET_TYPED_OBJECT:
		{
			if (action->GetActionData() == WIDGET_TYPE_HOTLIST)
			{
				action->SetActionObject(this);
				return TRUE;
			}
			return FALSE;
		}

		case OpInputAction::ACTION_HIDE_PANEL:
		{
			if (action->GetActionData() == -1 && IsCollapsableToSmall())
			{
				return m_selector->SetSelected(-1, TRUE);
			}

			BOOL has_focus = IsFocused(TRUE);
			BOOL result = ShowPanelByName(action->GetActionDataString(), FALSE);

			if( has_focus )
			{
				DesktopWindow *window = g_application->GetActiveDesktopWindow();
				if( window )
				{
					//Does not work. Would like to use it but does not work yet [espen 2004-04-01]
					//window->RestoreFocus(FOCUS_REASON_OTHER);
					g_input_manager->InvokeAction(OpInputAction::ACTION_FOCUS_PAGE);
				}
			}

			return result;
		}

		case OpInputAction::ACTION_SHOW_PANEL:
		case OpInputAction::ACTION_FOCUS_PANEL:
		{
			INT32 index = action->GetActionData();

			HotlistPanel* panel = NULL;
			BOOL handled = FALSE;

			if (action->HasActionDataString()) // show a specific panel (another panel might already be open)
			{
				handled = ShowPanelByName(action->GetActionDataString(), TRUE);

				if (!handled && action->GetAction() == OpInputAction::ACTION_SHOW_PANEL)
					return FALSE;

				panel = GetPanelByType(GetPanelTypeByName(action->GetActionDataString()), &index);
			}
			else if (action->GetAction() == OpInputAction::ACTION_FOCUS_PANEL ||	// focus a specific panel
					 GetAlignment() == ALIGNMENT_OFF || GetSelectedPanel() == -1)	// show the currently active panel (no panel is currently open)
			{
				if (index == -1)
					index = ReadActiveTab();

				panel = GetPanel(index);
			}
			else // don't show anything (advance to next input action, which is normally: hide panel)
			{
				action->SetWasReallyHandled(FALSE);
				return TRUE;
			}

			if (!panel)
				return FALSE;

			// make sure we are visible

			if (SetAlignment(OpBar::ALIGNMENT_OLD_VISIBLE))
				handled = TRUE;

			SyncLayout();

			if (m_selector->SetSelected(index, TRUE, TRUE))
				handled = TRUE;

			if (GetParentDesktopWindow()->Activate())
				handled = TRUE;

			panel->RestoreFocus(FOCUS_REASON_ACTION);

			return handled;
		}

		case OpInputAction::ACTION_REMOVE_PANEL:
		{
			if (web_panel)
			{
				g_hotlist_manager->ShowInPanel( web_panel->GetID(), FALSE );
			}
			else if (panel)
			{
				RemovePanel(m_selector->GetFocused());
				m_selector->WriteContent();
			}
			return TRUE;
		}

		case OpInputAction::ACTION_EDIT_PANEL:
		{
			if (web_panel)
			{
				g_hotlist_manager->EditItem( web_panel->GetID(), GetParentDesktopWindow() );
			}
			return TRUE;
		}

		case OpInputAction::ACTION_SHOW_CONTEXT_MENU:
		{
			ShowContextMenu(m_selector->GetBounds().Center(),TRUE,TRUE);
			return TRUE;
		}

		case OpInputAction::ACTION_ADD_WEB_PANEL:
		{
			AddWebPanelController* controller = OP_NEW(AddWebPanelController, ());
			OpStatus::Ignore(ShowDialog(controller, g_global_ui_context, g_application->GetActiveDocumentDesktopWindow()));
			return TRUE;
		}

		case OpInputAction::ACTION_MANAGE:
		{
			if (action->HasActionDataString() || !panel)
				return FALSE;

			if (web_panel)
			{
				OpenURLSetting settings;
				web_panel->GetURL(settings.m_address);
				settings.m_ignore_modifier_keys = (action->IsKeyboardInvoked());

				g_application->OpenURL(settings);
			}
			else
			{
				g_application->GetPanelDesktopWindow(panel->GetType() , TRUE);
			}
			return TRUE;
		}
	}

	return FALSE;
}
Esempio n. 19
0
void Hotlist::OnReadPanels(PrefsSection *section)
{
	OP_PROFILE_METHOD("Created panels");

	//remember which panels exist right now, so we know what to remove
	OpVector<HotlistPanel> removed_panels;

	for (INT32 i=0; i < GetPanelCount(); ++i)
	{
		HotlistPanel* old_panel = GetPanel(i);
		if (old_panel->GetType() != PANEL_TYPE_WEB)	//web panels are maintained by the bookmarks events
			removed_panels.Add(old_panel);
	}

	//read panel setup and apply to current setup
	if (section)
	{
		for (const PrefsEntry *entry = section->Entries(); entry; entry = (const PrefsEntry *) entry->Suc())
		{
			OpLineParser line(entry->Key());

			OpString item_type;
			INT32 pos = -1;

			if (OpStatus::IsError(line.GetNextToken(item_type)))
				continue;

			line.GetNextValue(pos);

			//get the new panel type;
			Type new_panel_type = GetPanelTypeByName(item_type.CStr());

			//move or create it if needed
			HotlistPanel* positioned_panel = PositionPanel(new_panel_type, pos);

			//this panel (if already existed) should not be removed
			OpStatus::Ignore(removed_panels.RemoveByItem(positioned_panel));
		}
	}

	//all panels in this list have not been reread, so they must have been removed
	while (removed_panels.GetCount() > 0)
	{
		INT32 pos;
		GetPanelByType(removed_panels.Get(0)->GetType(), &pos);
		OP_ASSERT(pos >= 0);	//panels in the removed_panels list should exist
		//delete panel and remove from the removal list
		RemovePanel(pos);
		removed_panels.Remove(0);
	}

	//update panels from bookmarks (webpanels)
	OnTreeChanged(g_hotlist_manager->GetBookmarksModel());

	INT32 active = ReadActiveTab();

	Collapse collapse = GetCollapse();
	if (collapse == COLLAPSE_SMALL)
		active = -1;

	m_selector->SetSelected(active, TRUE, TRUE);
}
Esempio n. 20
0
void Hotlist::OnChange(OpWidget *widget, BOOL changed_by_mouse)
{
	if (widget == m_selector)
	{
		INT32 selected = m_selector->GetSelected();
		if (selected < GetPanelCount())
		{
			for (INT32 i = 0; i < GetPanelCount(); i++)
			{
				HotlistPanel *panel = GetPanel(i);

				panel->SetVisibility(i == selected);

				// if selector does not have focus, restore focus to previous focuses widget in this panel
				// this is what the user would desire, right?

				if (i == selected && (changed_by_mouse || !m_selector->IsFocused()))
				{
					panel->RestoreFocus(FOCUS_REASON_OTHER);
				}
			}

			if (selected == -1)
			{
				if (IsCollapsableToSmall())
				{
					SetCollapse(COLLAPSE_SMALL, TRUE);

					if (GetWorkspace() && GetWorkspace()->GetActiveDesktopWindow())
					{
						GetWorkspace()->GetActiveDesktopWindow()->RestoreFocus(FOCUS_REASON_OTHER);
					}
				}
				else
				{
					m_selector->SetSelected(ReadActiveTab(), TRUE, TRUE);
				}
			}
			else
			{
				SetCollapse(GetCollapse() == COLLAPSE_SMALL ? COLLAPSE_NORMAL : GetCollapse(), TRUE);
				SaveActiveTab(m_selector->GetSelected());
			}

			g_input_manager->UpdateAllInputStates();

			if (GetParentDesktopWindow())
				GetParentDesktopWindow()->OnChange(this, changed_by_mouse);
		}
	}
	else
	{
		INT32 count = GetPanelCount();

		for (INT32 i = 0; i < count; i++)
		{
			HotlistPanel* panel = GetPanel(i);

			if (widget == panel)
			{
				OpString text;
				panel->GetPanelText(text, PANEL_TEXT_LABEL);

				OpButton* button = (OpButton*) m_selector->GetWidget(i);

				button->SetText(text.CStr());
				button->GetForegroundSkin()->SetImage(panel->GetPanelImage());
				button->SetAttention(panel->GetPanelAttention());

				if (GetParentDesktopWindow() && i == m_selector->GetSelected())
					GetParentDesktopWindow()->OnChange(this, changed_by_mouse);

				return;
			}
		}
	}
}
Esempio n. 21
0
void CSearchInputBox::OnSearchStart()
{
	CSearchPanel* pPanel = (CSearchPanel*)GetPanel();
	pPanel->ExecuteSearch();
}