Ejemplo n.º 1
0
void Skein::NewLine(const CStringW& line)
{
  bool nodeAdded = false;
  CStringW nodeLine = EscapeLine(line,UsePrintable);

  // Is there a child node with the same line?
  Node* node = m_inst.current->Find(nodeLine);
  if (node == NULL)
  {
    node = new Node(nodeLine,L"",L"",L"",false);
    m_inst.current->Add(node);
    nodeAdded = true;
  }

  // Make this the new current node
  m_inst.current = node;
  m_played = node;

  // Notify any listeners
  if (nodeAdded)
  {
    m_layout = false;
    NotifyChange(TreeChanged);
    NotifyEdit(true);
  }
  else
    NotifyChange(ThreadChanged);

  NotifyShowNode(node,ShowNewLine);
}
Ejemplo n.º 2
0
	virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
	{
		if (msg == WM_NOTIFY) {
			LPNMHDR lpnmhdr = (LPNMHDR)lParam;
			if (lpnmhdr->idFrom == IDC_EXTRAORDER && lpnmhdr->code == NM_RCLICK) {
				HTREEITEM hSelected = m_tree.GetDropHilight();
				if (hSelected != NULL && !m_tree.IsSelected(hSelected)) {
					m_tree.UnselectAll();
					m_tree.SelectItem(hSelected);
				}

				int sels = m_tree.GetNumSelected();
				if (sels > 1) {
					if (ShowPopup(0) == ID_GROUP) {
						GroupSelectedItems();
						NotifyChange();
					}
				}
				else if (sels == 1) {
					HTREEITEM hItem = m_tree.GetSelection();
					intlist *ids = Tree_GetIDs(hItem);
					if (ids->count > 1) {
						if (ShowPopup(1) == ID_UNGROUP) {
							UngroupSelectedItems();
							NotifyChange();
						}
					}
				}
			}
		}

		return CDlgBase::DlgProc(msg, wParam, lParam);
	}
// Paste text from either the clipboard or selection.
void ScintillaQt::pasteFromClipboard(QClipboard::Mode mode)
{
    int len;
    const char *s;
    bool rectangular;

    const QMimeData *source = QApplication::clipboard()->mimeData(mode);

    if (!source || !qsb->canInsertFromMimeData(source))
        return;

    QByteArray text = qsb->fromMimeData(source, rectangular);
    len = text.length();
    s = text.data();

    s = Document::TransformLineEnds(&len, s, len, pdoc->eolMode);

    UndoGroup ug(pdoc);

    ClearSelection();

    SelectionPosition start = sel.IsRectangular() ? sel.Rectangular().Start()
            : sel.Range(sel.Main()).Start();

    if (rectangular)
        PasteRectangular(start, s, len);
    else
        InsertPaste(start, s, len);

    delete[] s;

    NotifyChange();
    Redraw();
}
Ejemplo n.º 4
0
void Skein::Trim(Node* node, bool running, bool notify)
{
  int i = 0;
  while (i < node->GetNumChildren())
  {
    Node* child = node->GetChild(i);
    bool inCurrent = InCurrentThread(child);

    // Only delete unlocked nodes. If the game is running, only delete
    // if the node is not in the current thread as well.
    if (child->GetTemporary() && !(running && inCurrent))
    {
      if (inCurrent)
      {
        m_current = m_root;
        m_played = m_root;
      }

      if (RemoveAll(child,false) == false)
        i++;
    }
    else
    {
      Trim(child,running,false);
      i++;
    }
  }

  if (notify)
    NotifyChange(TreeChanged);
}
Ejemplo n.º 5
0
void Skein::SetLine(Node* node, LPCWSTR line)
{
  if (node->SetLine(line))
    NotifyEdit(true);
  m_layout = false;
  NotifyChange(NodeTextChanged);
}
Ejemplo n.º 6
0
 void SaveData()
 {
     if ( !GetPropertyContainer() || !m_Extra ) return;
     m_Extra->m_Label = Label->GetValue();
     m_Extra->m_Selected = Selected->GetValue();
     NotifyChange();
 }
Ejemplo n.º 7
0
    void Camera::SetPosition(const cocos2d::CCPoint &newPosition)
    {
		cocos2d::CCPoint innerPos = newPosition;
		if (newPosition.x < 4.8f)
		{
			innerPos.x = 4.8f;
		}
		else if (newPosition.x > WorldManager::Instance()->GetSceneInfo()->GetWidth() - 9.6f)
		{
			innerPos.x = WorldManager::Instance()->GetSceneInfo()->GetWidth() - 9.6f;
		}
		if (newPosition.y < 3.2f)
		{
			innerPos.y = 3.2f;
		}
		else if (newPosition.y > WorldManager::Instance()->GetSceneInfo()->GetHeight() - 4.8f)
		{
			innerPos.y = WorldManager::Instance()->GetSceneInfo()->GetHeight() - 4.8f;
		}
        m_position = innerPos;
		cocos2d::CCPoint entityPos = m_position;
        entityPos.x -= m_size.width / 2;
        entityPos.y -= m_size.height / 2;
        CameraPosChanged event(entityPos);
        NotifyChange(&event);
    }
NS_IMETHODIMP
nsSubscribableServer::AddTo(const nsACString& aName, bool aAddAsSubscribed,
                            bool aSubscribable, bool aChangeIfExists)
{
    nsresult rv = NS_OK;

    if (mStopped) {
#ifdef DEBUG_seth
        printf("stopped!\n");
#endif
        return NS_ERROR_FAILURE;
    }

    SubscribeTreeNode *node = nsnull;

    // todo, shouldn't we pass in aAddAsSubscribed, for the
    // default value if we create it?
    rv = FindAndCreateNode(aName, &node);
    NS_ENSURE_SUCCESS(rv,rv);

    NS_ASSERTION(node,"didn't find the node");
    if (!node) return NS_ERROR_FAILURE;

    if (aChangeIfExists) {
        node->isSubscribed = aAddAsSubscribed;
        rv = NotifyChange(node, kNC_Subscribed, node->isSubscribed);
        NS_ENSURE_SUCCESS(rv,rv);
    }

    node->isSubscribable = aSubscribable;
    return rv;
}
Ejemplo n.º 9
0
void wxsProject::Configure()
{
    if ( !m_GUI )
    {
        m_GUI = wxsGUIFactory::SelectNew(_("wxSmith does not manage any GUI for this project.\nPlease select GUI you want to be managed in wxSmith."),this);
        if ( m_GUI )
        {
            NotifyChange();
        }
    }

    if ( m_GUI )
    {
        if ( !m_GUI->CheckIfApplicationManaged() )
        {
            // TODO: Prepare better communicate, consider chancing to cbAnnoyingDiaog
            if ( wxMessageBox(_("wxSmith does not manage this application's source.\n"
                                "Should I create proper bindings?"),_("wxSmith"),wxYES_NO) == wxNO ) return;
            if ( !m_GUI->CreateApplicationBinding() ) return;
        }
        cbConfigurationDialog Dlg(0,-1,_("Configuring wxSmith"));
        Dlg.AttachConfigurationPanel(m_GUI->BuildConfigurationPanel(&Dlg));
        Dlg.ShowModal();
    }
}
Ejemplo n.º 10
0
void Skein::Import(const char* path)
{
  Node* node = m_inst.root;
  bool added = false;

  CStdioFile recFile;
  if (recFile.Open(path,CFile::modeRead|CFile::typeText))
  {
    CString recLine;
    while (recFile.ReadString(recLine))
    {
      recLine.Trim();
      if (recLine.GetLength() > 0)
      {
        CStringW recLineW = EscapeLine(CStringW(recLine),UsePrintable);
        Node* newNode = node->Find(recLineW);
        if (newNode == NULL)
        {
          newNode = new Node(recLineW,L"",L"",L"",false);
          node->Add(newNode);
          added = true;
        }
        node = newNode;
      }
    }

    if (added)
    {
      m_layout = false;
      NotifyChange(TreeChanged);
      NotifyEdit(true);
    }
  }
}
Ejemplo n.º 11
0
void wxsSizerParentQP::SaveData()
{
    if ( !GetPropertyContainer() || !m_Extra ) return;

    m_Extra->Flags = 0;
    if ( BrdLeft  ->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::BorderLeft;
    if ( BrdRight ->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::BorderRight;
    if ( BrdTop   ->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::BorderTop;
    if ( BrdBottom->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::BorderBottom;
    m_Extra->Border.Value       = BrdSize->GetValue();
    m_Extra->Border.DialogUnits = BrdDlg->GetValue();

    if ( PlaceExp ->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::Expand;
    if ( PlaceShp ->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::Shaped;

    if ( PlaceLT->GetValue() || PlaceCT->GetValue() || PlaceRT->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::AlignTop;
    if ( PlaceLC->GetValue() || PlaceCC->GetValue() || PlaceRC->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::AlignCenterVertical;
    if ( PlaceLB->GetValue() || PlaceCB->GetValue() || PlaceRB->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::AlignBottom;
    if ( PlaceLT->GetValue() || PlaceLC->GetValue() || PlaceLB->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::AlignLeft;
    if ( PlaceCT->GetValue() || PlaceCC->GetValue() || PlaceCB->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::AlignCenterHorizontal;
    if ( PlaceRT->GetValue() || PlaceRC->GetValue() || PlaceRB->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::AlignRight;

    m_Extra->Proportion         = Proportion->GetValue();

    NotifyChange();
}
Ejemplo n.º 12
0
void Skein::SetLabel(Node* node, LPCWSTR label)
{
  if (node->SetLabel(label))
    NotifyEdit(true);
  m_layout = false;
  NotifyChange(NodeTextChanged);
}
Ejemplo n.º 13
0
void Skein::Reset(bool current)
{
  if (current)
    m_inst.current = m_inst.root;

  m_played = m_inst.root;
  NotifyChange(ThreadChanged);
}
Ejemplo n.º 14
0
	void Camera::Reset( void )
	{
		cocos2d::CCPoint entityPos = m_position;
		entityPos.x -= m_size.width / 2;
		entityPos.y -= m_size.height / 2;
		CameraReset event(entityPos);
		NotifyChange(&event);
	}
Ejemplo n.º 15
0
void Skein::Unlock(Node* node, bool notify)
{
  if (node->SetLocked(false))
    NotifyEdit(true);
  for (int i = 0; i < node->GetNumChildren(); i++)
    Unlock(node->GetChild(i),false);
  if (notify)
    NotifyChange(LockChanged);
}
Ejemplo n.º 16
0
void wxsAuiManagerParentQP::OnCaptionButtonClick(wxCommandEvent& event)
{
    m_Extra->m_MinimizeButton = MinimizeButton->GetValue();
    m_Extra->m_MaximizeButton = MaximizeButton->GetValue();
    m_Extra->m_PinButton      = PinButton->GetValue();
    m_Extra->m_CloseButton    = CloseButton->GetValue();

    NotifyChange();
}
Ejemplo n.º 17
0
	void SceneObjectProp::Init( int id, const char *imageName, float x, float y, float width, float height )
	{
		m_id = id;
		m_imageName = imageName;
		m_position = cocos2d::CCPointMake(x, y);
		m_size = cocos2d::CCSizeMake(width, height);
		SceneObjectEventInit event(m_imageName, m_position, m_size);
		NotifyChange(&event);
	}
Ejemplo n.º 18
0
void wxsAuiManagerParentQP::OnDockChange(wxCommandEvent& event)
{
    if ( !GetPropertyContainer() || !m_Extra ) return;

    m_Extra->m_Docked    = Docked->GetValue();
    m_Extra->m_DockFixed = DockFixed->GetValue();

    NotifyChange();
}
Ejemplo n.º 19
0
void Skein::Lock(Node* node)
{
  while (node != NULL)
  {
    if (node->SetLocked(true))
      NotifyEdit(true);
    node = node->GetParent();
  }
  NotifyChange(LockChanged);
}
Ejemplo n.º 20
0
void wxsAuiManagerParentQP::OnDockSiteChange(wxSpinEvent& event)
{
    if ( !GetPropertyContainer() || !m_Extra ) return;

    m_Extra->m_Layer    = Layer->GetValue();
    m_Extra->m_Row      = Row->GetValue();
    m_Extra->m_Position = Position->GetValue();

    NotifyChange();
}
Ejemplo n.º 21
0
void Skein::UpdateAfterPlaying(const CStringW& transcript)
{
  // Update the status of the last played node
  if (transcript.IsEmpty() == FALSE)
    m_played->NewTranscriptText(transcript);

  NotifyChange(NodeColourChanged);
  if (transcript.IsEmpty() == FALSE)
    NotifyShowNode(m_played,ShowNewTranscript);
}
Ejemplo n.º 22
0
void Skein::Bless(Node* node, bool all)
{
  while (node != NULL)
  {
    if (node->Bless())
      NotifyEdit(true);
    node = all ? node->GetParent() : NULL;
  }
  NotifyChange(NodeColourChanged);
}
Ejemplo n.º 23
0
void wxsAuiManagerParentQP::OnDockDirectionChange(wxCommandEvent& event)
{
    if ( !GetPropertyContainer() || !m_Extra ) return;

    if ( DockTop->GetValue() && (m_Extra->m_DockDirection != wxAUI_DOCK_TOP) )
    {
        m_Extra->m_DockDirection = wxAUI_DOCK_TOP;
        m_Extra->m_DockableFlags |= wxsAuiDockableProperty::TopDockable;
        DockBottom->SetValue(false);
        DockLeft->  SetValue(false);
        DockRight-> SetValue(false);
        DockCenter->SetValue(false);
    }
    else if ( DockBottom->GetValue() && (m_Extra->m_DockDirection != wxAUI_DOCK_BOTTOM) )
    {
        m_Extra->m_DockDirection = wxAUI_DOCK_BOTTOM;
        m_Extra->m_DockableFlags |= wxsAuiDockableProperty::BottomDockable;
        DockLeft->  SetValue(false);
        DockRight-> SetValue(false);
        DockCenter->SetValue(false);
    }
    else if ( DockLeft->GetValue() && (m_Extra->m_DockDirection != wxAUI_DOCK_LEFT) )
    {
        m_Extra->m_DockDirection = wxAUI_DOCK_LEFT;
        m_Extra->m_DockableFlags |= wxsAuiDockableProperty::LeftDockable;
        DockRight-> SetValue(false);
        DockCenter->SetValue(false);
    }
    else if ( DockRight->GetValue() && (m_Extra->m_DockDirection != wxAUI_DOCK_RIGHT) )
    {
        m_Extra->m_DockDirection = wxAUI_DOCK_RIGHT;
        m_Extra->m_DockableFlags |= wxsAuiDockableProperty::RightDockable;
        DockCenter->SetValue(false);
    }
    else if ( DockCenter->GetValue() && (m_Extra->m_DockDirection != wxAUI_DOCK_CENTER) )
    {
        m_Extra->m_DockDirection = wxAUI_DOCK_CENTER;
        m_Extra->m_DockableFlags = wxsAuiDockableProperty::Dockable;
    }
    else
    {
        m_Extra->m_DockDirection = wxAUI_DOCK_LEFT;
        m_Extra->m_DockableFlags |= wxsAuiDockableProperty::LeftDockable;
        m_Extra->m_Docked        = false;

        Docked->    SetValue(false);
        DockTop->   SetValue(false);
        DockBottom->SetValue(false);
        DockLeft->  SetValue(true);
        DockRight-> SetValue(false);
        DockCenter->SetValue(false);
    }

    NotifyChange();
}
Ejemplo n.º 24
0
Void CPropertyConcrete<DataType>::SetValue( const DataType& value )
{
    if( m_Value != value && m_CanSetValue)
    {
        m_CanSetValue = FALSE;
        DataType oldValue = m_Value;
        m_Value = value;
        NotifyChange( oldValue );
        m_CanSetValue = TRUE;
    }
}
Ejemplo n.º 25
0
void Skein::Reset()
{
  delete m_inst.root;
  m_inst.root = new Node(L"- start -",L"",L"",L"",false);
  m_inst.current = m_inst.root;
  m_played = m_inst.root;

  m_layout = false;
  NotifyChange(TreeChanged);
  NotifyEdit(false);
}
Ejemplo n.º 26
0
// Call ReadDirectoryChangesW to check if the file has changed since the last call.
bool FileWatcher::CheckForChanges(DWORD waittime)
{
    if (!overl.hEvent)
        return false;

    DWORD dwObj = WaitForSingleObject(overl.hEvent, waittime);
    if (dwObj != WAIT_OBJECT_0)
        return false;

    return NotifyChange();
}
Ejemplo n.º 27
0
void wxsAuiManagerParentQP::OnGeneralChange(wxCommandEvent& event)
{
    m_Extra->m_Visible        = Visible->GetValue();
    m_Extra->m_Resizable      = Resizable->GetValue();
    m_Extra->m_PaneBorder     = PaneBorder->GetValue();
    m_Extra->m_Movable        = Movable->GetValue();
    m_Extra->m_Floatable      = Floatable->GetValue();
    m_Extra->m_DestroyOnClose = DestroyOnClose->GetValue();

    NotifyChange();
}
Ejemplo n.º 28
0
Skein::Node* Skein::AddNew(Node* node)
{
  Node* newNode = new Node(L"",L"",L"",L"",false);
  node->Add(newNode);

  m_layout = false;
  NotifyChange(TreeChanged);
  NotifyEdit(true);

  return newNode;
}
Ejemplo n.º 29
0
Skein::Node* Skein::AddNewParent(Node* node)
{
  Node* newNode = new Node(L"",L"",L"",L"",false);
  node->GetParent()->Replace(node,newNode);
  newNode->Add(node);

  m_layout = false;
  NotifyChange(TreeChanged);
  NotifyEdit(true);

  return newNode;
}
Ejemplo n.º 30
0
bool Skein::NextLine(CStringW& line)
{
  // Find the next node to use
  Node* next = m_played->FindAncestor(m_inst.current);
  if (next != NULL)
  {
    line = EscapeLine(next->GetLine(),UseCharacters);
    m_played = next;
    NotifyChange(ThreadChanged);
    NotifyShowNode(next,ShowNewLine);
    return true;
  }
  return false;
}