示例#1
0
文件: GText.cpp 项目: FEI17N/Lgi
bool TextView::Cut()
{
	if (Flags & TVF_SELECTION)
	{
		OnDeleteSelection(TRUE);
		UpdateHiddenCheck();
		return TRUE;
	}
	return FALSE;
}
示例#2
0
void QmitkTubeGraphView::CreateConnections()
{
  mitk::NodePredicateDataType::Pointer tubeGraphPred = mitk::NodePredicateDataType::New("TubeGraph");
  m_Controls.activeGraphComboBox->SetDataStorage(this->GetDataStorage());
  m_Controls.activeGraphComboBox->SetPredicate(tubeGraphPred);

  //activation mode
  connect( m_Controls.activeGraphComboBox, SIGNAL(currentIndexChanged (int)), this, SLOT(OnActiveGraphChanged(int)) );
  connect( m_Controls.noneModeRadioButton, SIGNAL(clicked()), this, SLOT(OnActivationModeChanged()));
  connect( m_Controls.singleModeRadioButton, SIGNAL(clicked()), this, SLOT(OnActivationModeChanged()));
  connect( m_Controls.multipleModeRadioButton, SIGNAL(clicked()), this, SLOT(OnActivationModeChanged()));
  connect( m_Controls.peripheryModeRadioButton, SIGNAL(clicked()), this, SLOT(OnActivationModeChanged()));
  connect( m_Controls.rootModeRadioButton, SIGNAL(clicked()), this, SLOT(OnActivationModeChanged()));
  connect( m_Controls.pointModeRadioButton, SIGNAL(clicked()), this, SLOT(OnActivationModeChanged()));
  connect( m_Controls.setRootButton, SIGNAL(toggled(bool)), this, SLOT(OnSetRootToggled(bool)));

  //deselect tubes
  connect( m_Controls.deselectAllButton, SIGNAL(clicked()), this, SLOT(OnDeselectAllTubes()));

  // tab switch
  connect( m_Controls.tubeGraphTabWidget, SIGNAL(currentChanged(int)), this, SLOT(OnTabSwitched(int)));

  //attributation tab
  connect( m_Controls.addLabelGroupButton, SIGNAL(clicked()), this, SLOT(OnAddingLabelGroup()));
  connect( m_Controls.removeLabelGroupButton, SIGNAL(clicked()), this, SLOT(OnRemoveLabelGroup()));

  //annotation tab
  connect( m_Controls.addAnnotationButton, SIGNAL(clicked()), this, SLOT(OnAddingAnnotation()));
  connect( m_Controls.deleteAnnotationButton, SIGNAL(clicked()), this, SLOT(OnRemoveAnnotation()));

  //edit tab
  connect( m_Controls.editSelectionNewButton, SIGNAL(clicked()), this, SLOT(OnAddTubeBetweenSelection()));
  connect( m_Controls.editSelectionSeperateButton, SIGNAL(clicked()), this, SLOT(OnSeperateSelection()));
  connect( m_Controls.editSelectionDeleteButton, SIGNAL(clicked()), this, SLOT(OnDeleteSelection()));


  this->SetTabsEnable(false);
}
示例#3
0
文件: GText.cpp 项目: FEI17N/Lgi
bool TextView::OnInsertText(char *Text, int Len)
{
	bool Status = false;

	OnDeleteSelection(FALSE);

	int OldLines = Doc.GetLines();
	Status = Doc.Insert(&User, Text, Len);
	if (Status)
	{
		if (OldLines != Doc.GetLines())
		{
			Dirty(TVF_DIRTY_TO_EOP);
		}
		else
		{
			Dirty(TVF_DIRTY_TO_EOL);
		}

		AfterInsertText(Text, Len);
	}

	return Status;
}
示例#4
0
void DisplayView::OnDeleteFilter()
{
    // ask the derived class to do it ...
    OnDeleteSelection();
}
示例#5
0
文件: GText.cpp 项目: FEI17N/Lgi
int TextView::ProcessKey(GKey &K)
{
	Flags &= ~(TVF_GOTO_START | TVF_GOTO_END | TVF_EAT_MOVE);

	if (!K.IsChar)
	{
		if (K.Shift())
		{
			Flags |= TVF_SHIFT;
		}
		else
		{
			Flags &= ~(TVF_SHIFT);
		}

		if (K.Down())
		{
			switch (K.c)
			{
				case VK_ESCAPE:
				{
					OnEscape(K);
					break;
				}
				case VK_RETURN:
				{
					OnEnter(K);
					break;
				}
				case VK_BACK:
				{
					if (K.Alt())
					{
						if (K.Ctrl())
						{
							Doc.Redo(User);
						}
						else
						{
							Doc.Undo(User);
						}

						Dirty(TVF_DIRTY_ALL);
					}
					else
					{
						if (Flags & TVF_SELECTION)
						{
							OnDeleteSelection(FALSE);
							UpdateHiddenCheck();
						}
						else if (User.Y() > 0 || User.X() > 0)
						{
							Flags &= ~(TVF_SHIFT);
							OnMoveCursor(-1, 0);
							OnDeleteText(&User, 1, FALSE);
						}
					}
					break;
				}
				case VK_RIGHT:
				case VK_LEFT:
				{
					bool bLeft = K.c == VK_LEFT;
					int Inc = (bLeft) ? -1 : 1;

					if (bLeft)
					{
						Flags |= TVF_GOTO_START;
					}
					else
					{
						Flags |= TVF_GOTO_END;
					}

					Flags |= TVF_EAT_MOVE;

					if (K.Ctrl())
					{
						char *c = User;

						if (bLeft)
						{
							OnMoveCursor(Inc, 0);
							c = User;
							while (	strchr(WhiteSpace, *c) AND
									OnMoveCursor(Inc, 0))
							{
								c = User;
							}
						}

						if (strchr(Delimiters, *c))
						{
							while (	strchr(Delimiters, *c) AND
									OnMoveCursor(Inc, 0))
							{
								c = User;
							}
						}
						else
						{
							// IsText(*c)
							while (	!strchr(WhiteSpace, *c) AND
									OnMoveCursor(Inc, 0))
							{
								c = User;
							}
						}

						if (bLeft)
						{
							if (User.Y() > 0 || User.X() > 0)
							{
								OnMoveCursor(-Inc, 0);
							}
						}
						else
						{
							while (	strchr(WhiteSpace, *c) AND
									OnMoveCursor(Inc, 0))
							{
								c = User;
							}
						}
					}
					else
					{
						OnMoveCursor(Inc, 0);
					}
					break;
				}
				case VK_UP:
				{
					Flags |= TVF_GOTO_START;
					OnMoveCursor(0, -1);
					break;
				}
				case VK_DOWN:
				{
					Flags |= TVF_GOTO_END;
					OnMoveCursor(0, 1);
					break;
				}
				case VK_PRIOR:
				{
					int Move = 1-DisplayLines;
					OnSetHidden(HiddenLines+Move);
					OnMoveCursor(0, Move);
					break;
				}
				case VK_NEXT:
				{
					int Move = DisplayLines-1;
					OnSetHidden(HiddenLines+Move);
					OnMoveCursor(0, Move);
					break;
				}
				case VK_HOME:
				{
					if (K.Ctrl())
					{
						OnSetCursor(0, 0);
					}
					else
					{
						OnMoveCursor(-User.X(), 0);
					}
					break;
				}
				case VK_END:
				{
					if (K.Ctrl())
					{
						OnSetCursor(1024, Doc.GetLines());
					}
					else
					{
						OnMoveCursor(User.LineLength()-User.X(), 0);
					}
					break;
				}
				case VK_DELETE:
				{
					if (	K.Shift() AND
							(Flags & TVF_SELECTION))
					{
						Cut();
					}
					else
					{
						if (Flags & TVF_SELECTION)
						{
							OnDeleteSelection(FALSE);
							UpdateHiddenCheck();
						}
						else if (	User.Y() < Doc.GetLines() ||
									User.X() < User.LineLength())
						{
							OnDeleteText(&User, 1, FALSE);
						}
					}
					break;
				}
				case VK_INSERT:
				{
					if (Flags & TVF_SELECTION)
					{
						if (K.Ctrl())
						{
							Copy();
						}
					}

					if (K.Shift())
					{
						Paste();
					}
					break;
				}
			}
		}
	}
	else
	{
		// IsChar
		#define EXTENDED (1<<24)

		// if (	!(K.Data & EXTENDED))
		{
			bool InsertChar = K.c >= ' '; //  AND K.c < 128

			if (K.c == 9)
			{
				if ((Flags & TVF_SELECTION) AND Start.Y() != End.Y())
				{
					if (Flags & TVF_SHIFT)
					{
						InsertChar = !OnMultiLineTab(false);
					}
					else
					{
						InsertChar = !OnMultiLineTab(true);
					}
				}
				else
				{
					InsertChar = true;
				}
			}
			
			if (InsertChar)
			{
				char Char[2] = " ";
				Char[0] = K.c;
				if (OnInsertText(Char))
				{
					OnMoveCursor(1, 0, true);
				}
			}
		}
	}

	return TRUE;
}