예제 #1
0
void CzpEditorView::OnUpdateMenu(CCmdUI* pCmdUI)
{
	if (m_pDocument == NULL)
	{
		pCmdUI->Enable(FALSE);
		return;
	}
	ZpExplorer& explorer = GetDocument()->GetZpExplorer();
	if (!explorer.isOpen())
	{
		pCmdUI->Enable(FALSE);
		return;
	}
	if (explorer.getPack()->readonly()
		&& (pCmdUI->m_nID == ID_FILE_DEFRAG
			|| pCmdUI->m_nID == ID_EDIT_ADD
			|| pCmdUI->m_nID == ID_EDIT_ADD_FOLDER
			|| pCmdUI->m_nID == ID_EDIT_DELETE))
	{
		pCmdUI->Enable(FALSE);
		return;
	}
	if (pCmdUI->m_nID == ID_EDIT_OPEN || pCmdUI->m_nID == ID_EDIT_DELETE)
	{
		pCmdUI->Enable(getSelectedNode() != NULL);
		return;
	}
	pCmdUI->Enable(TRUE);
}
예제 #2
0
void CzpEditorView::OnEditAdd()
{
	CFileDialog dlg(TRUE, NULL, NULL, OFN_ALLOWMULTISELECT);
	if (dlg.DoModal() != IDOK)
	{
		return;
	}
	zp::String addToDir;
	ZpNode* node = getSelectedNode();
	if (node != NULL && node->isDirectory)
	{
		addToDir = node->name;
	}
	zp::u64 totalFileSize = 0;
	std::vector<std::pair<zp::String, zp::String>> params;
	ZpExplorer& explorer = GetDocument()->GetZpExplorer();
	POSITION pos = dlg.GetStartPosition();
	while (pos)
	{
		CString filename = dlg.GetNextPathName(pos);
		totalFileSize += explorer.countDiskFileSize(filename.GetString());
		params.push_back(std::make_pair(filename.GetString(), addToDir));
	}
	startOperation(ProgressDialog::OP_ADD, totalFileSize, &params);
	m_pDocument->UpdateAllViews(NULL);
}
예제 #3
0
/*!\func
 *
 * \param
 * \return
 */
void GraphBody::on_actionHelp_triggered()
{
	if(INode*n = getSelectedNode())
	{
		n->Edit();
		change(true);
	}
	LOG(LOG_DEBUG, QString(__FUNCTION__) + " <" + QString::number(__LINE__) + ">");
}
예제 #4
0
void CzpEditorView::OnEditOpen()
{
	CListCtrl& listCtrl = GetListCtrl();
	if (listCtrl.GetSelectedCount() > 1)
	{
		return;
	}
	ZpNode* node = getSelectedNode();
	openNode(node);
}
예제 #5
0
bool CocaSystemTree::selectNode( const coca::INode& node )
{
    if ( &node == getSelectedNode() ) { return true; }

    wxTreeItemId id = findId( node );
    if ( id.IsOk() )
    {
        SelectItem( id );
        EnsureVisible( id );
    }

    return id.IsOk();
}
예제 #6
0
파일: RangeImpl.cpp 프로젝트: mydw/mydw
/**
 * Visits the nodes selected by this range when we know
 * a-priori that the start and end containers are the same.
 *
 */
DOM_DocumentFragment RangeImpl::traverseSameContainer( int how )
{
    DOM_DocumentFragment frag = null;
    if ( how!=DELETE_CONTENTS)
        frag = fDocument.createDocumentFragment();

    // If selection is empty, just return the fragment
    if ( fStartOffset==fEndOffset )
        return frag;

    DOM_Node current = fStartContainer;
    DOM_Node cloneCurrent = null;

    // Text node needs special case handling
    if ( fStartContainer.getNodeType()== DOM_Node::TEXT_NODE )
    {
        cloneCurrent = fStartContainer.cloneNode(false);
        cloneCurrent.setNodeValue(
            cloneCurrent.getNodeValue().substringData(fStartOffset, fEndOffset - fStartOffset));

        // set the original text node to its new value
        if ( how != CLONE_CONTENTS )
            ((DOM_Text &)fStartContainer).deleteData(fStartOffset, fEndOffset-fStartOffset);
        if ( how != DELETE_CONTENTS)
            frag.appendChild(cloneCurrent);
    }
    else {
        // Copy nodes between the start/end offsets.
        DOM_Node n = getSelectedNode( fStartContainer, fStartOffset );
        int cnt = fEndOffset - fStartOffset;
        while( cnt > 0 )
        {
            DOM_Node sibling = n.getNextSibling();
            DOM_Node xferNode = traverseFullySelected( n, how );
            if ( frag!=null )
                frag.appendChild( xferNode );
            --cnt;
            n = sibling;
        }
    }

    // Nothing is partially selected, so collapse to start point
    if ( how != CLONE_CONTENTS )
        collapse(true);
    return frag;
}
예제 #7
0
파일: RangeImpl.cpp 프로젝트: mydw/mydw
/**
 * Traverses the "right boundary" of this range and
 * operates on each "boundary node" according to the
 * how parameter.  It is a-priori assumed
 * by this method that the right boundary does
 * not contain the range's start container.
 *
 * A "right boundary" is best visualized by thinking
 * of a sample tree:
 *                 A
 *                /|\
 *               / | \
 *              /  |  \
 *             B   C   D
 *            /|\     /|\
 *           E F G   H I J
 *
 * Imagine first a range that begins between the
 * "E" and "F" nodes and ends between the
 * "I" and "J" nodes.  The start container is
 * "B" and the end container is "D".  Given this setup,
 * the following applies:
 *
 * Partially Selected Nodes: B, D<br>
 * Fully Selected Nodes: F, G, C, H, I
 *
 * The "right boundary" is the highest subtree node
 * that contains the ending container.  The root of
 * this subtree is always partially selected.
 *
 * In this example, the nodes that are traversed
 * as "right boundary" nodes are: H, I, and D.
 *
 */
DOM_Node RangeImpl::traverseRightBoundary( DOM_Node root, int how )
{
    DOM_Node next = getSelectedNode( fEndContainer, fEndOffset-1 );
    bool isFullySelected = ( next!=fEndContainer );

    if ( next==root )
        return traverseNode( next, isFullySelected, false, how );

    DOM_Node parent = next.getParentNode();
    DOM_Node clonedParent = traverseNode( parent, false, false, how );

    while( parent!=null )
    {
        while( next!=null )
        {
            DOM_Node prevSibling = next.getPreviousSibling();
            DOM_Node clonedChild =
                traverseNode( next, isFullySelected, false, how );
            if ( how!=DELETE_CONTENTS )
            {
                clonedParent.insertBefore(
                    clonedChild,
                    clonedParent.getFirstChild()
                );
            }
            isFullySelected = true;
            next = prevSibling;
        }
        if ( parent==root )
            return clonedParent;

        next = parent.getPreviousSibling();
        parent = parent.getParentNode();
        DOM_Node clonedGrandParent = traverseNode( parent, false, false, how );
        if ( how!=DELETE_CONTENTS )
            clonedGrandParent.appendChild( clonedParent );
        clonedParent = clonedGrandParent;

    }

    // should never occur
    return null;
}
예제 #8
0
파일: RangeImpl.cpp 프로젝트: mydw/mydw
/**
 * Traverses the "left boundary" of this range and
 * operates on each "boundary node" according to the
 * how parameter.  It is a-priori assumed
 * by this method that the left boundary does
 * not contain the range's end container.
 *
 * A "left boundary" is best visualized by thinking
 * of a sample tree:
 *
 *                 A
 *                /|\
 *               / | \
 *              /  |  \
 *             B   C   D
 *            /|\     /|\
 *           E F G   H I J
 *
 * Imagine first a range that begins between the
 * "E" and "F" nodes and ends between the
 * "I" and "J" nodes.  The start container is
 * "B" and the end container is "D".  Given this setup,
 * the following applies:
 *
 * Partially Selected Nodes: B, D<br>
 * Fully Selected Nodes: F, G, C, H, I
 *
 * The "left boundary" is the highest subtree node
 * that contains the starting container.  The root of
 * this subtree is always partially selected.
 *
 * In this example, the nodes that are traversed
 * as "left boundary" nodes are: F, G, and B.
 *
 */
DOM_Node RangeImpl::traverseLeftBoundary( DOM_Node root, int how )
{
    DOM_Node next = getSelectedNode( getStartContainer(), getStartOffset() );
    bool isFullySelected = ( next!=getStartContainer() );

    if ( next==root )
        return traverseNode( next, isFullySelected, true, how );

    DOM_Node parent = next.getParentNode();
    DOM_Node clonedParent = traverseNode( parent, false, true, how );

    while( parent!=null )
    {
        while( next!=null )
        {
            DOM_Node nextSibling = next.getNextSibling();
            DOM_Node clonedChild =
                traverseNode( next, isFullySelected, true, how );
            if ( how!=DELETE_CONTENTS )
                clonedParent.appendChild(clonedChild);
            isFullySelected = true;
            next = nextSibling;
        }
        if ( parent==root )
            return clonedParent;

        next = parent.getNextSibling();
        parent = parent.getParentNode();
        DOM_Node clonedGrandParent = traverseNode( parent, false, true, how );
        if ( how!=DELETE_CONTENTS )
            clonedGrandParent.appendChild( clonedParent );
        clonedParent = clonedGrandParent;

    }

    // should never occur
    return null;

}
예제 #9
0
void CzpEditorView::OnEditAddFolder()
{
	CFolderDialog folderDlg(NULL, _T("Select folder to add to package."));
	if (folderDlg.DoModal() != IDOK)
	{
		return;
	}
	zp::String addToDir;
	ZpNode* node = getSelectedNode();
	if (node != NULL && node->isDirectory)
	{
		addToDir = node->name;
	}
	CString path = folderDlg.GetPathName();
	ZpExplorer& explorer = GetDocument()->GetZpExplorer();
	zp::u64 totalFileSize = explorer.countDiskFileSize(path.GetString());

	std::vector<std::pair<zp::String, zp::String>> params;
	params.push_back(std::make_pair(path.GetString(), addToDir));
	startOperation(ProgressDialog::OP_ADD, totalFileSize, &params);
	m_pDocument->UpdateAllViews(NULL);
}
예제 #10
0
파일: input.c 프로젝트: A2Command/a2command
void  readKeyboard(void)
{
	struct dir_node *currentNode;
	unsigned char key;
	bool decision = false;

	key = toupper(cgetc());

	switch((int)key)
	{
	case HK_FORMATTER:
		if(loadOverlay(7))
		{
			formatDisk(selectedPanel);

			clrscr();
			writeMenuBar();
			reloadPanels();
		}
		break;
	case HK_BASIC_VIEWER:
		if(loadOverlay(6))
		{
			viewFileAsBASIC(selectedPanel);

			clrscr();
			writeMenuBar();
			reloadPanels();
		}
		break;
	case HK_HEX_EDIT:
		if(loadOverlay(5))
		{
			hexEditCurrentFile(selectedPanel);

			clrscr();
			writeMenuBar();
			reloadPanels();
		}
		break;

	case CH_ENTER:
		currentNode = getSelectedNode(selectedPanel);
		if(isDirectory(selectedPanel))
		{
			enterDirectory(selectedPanel);
		}
		else if(currentNode != NULL)
		{
			sprintf(filePath, "%s/%s", selectedPanel->path, currentNode->name);
			if(currentNode->type == 0x06
				|| currentNode->type == 0xFF)
			{
				saveScreen();
				decision = writeYesNo("Confirm", quit_message, 1);
				retrieveScreen();

				if(decision == true)
				{
					exec(filePath, NULL);
				}
			}
			else if(currentNode->type == 0xFC)
			{
				if(loadOverlay(6))
				{
					viewFileAsBASIC(selectedPanel);

					clrscr();
					writeMenuBar();
					reloadPanels();
				}
			}
			else
			{
				if(loadOverlay(1))
					viewFile(filePath);
			}
		}
		break;
	case KEY_F4:
		rereadSelectedPanel();
		break;
	case KEY_F3:
		selectDrive(selectedPanel);
		rereadSelectedPanel();
		break;
	case HK_SELECT:
		selectCurrentFile();
		break;
#ifdef __APPLE2ENH__
		case CH_CURS_UP:
#else
		case CH_CURS_LEFT:
#endif
		moveSelectorUp(selectedPanel);
		break;
#ifdef __APPLE2ENH__
		case CH_CURS_DOWN:
#else
		case CH_CURS_RIGHT:
#endif
		moveSelectorDown(selectedPanel);
		break;
#ifdef __APPLE2ENH__
	case CH_CURS_LEFT:
		if(selectedPanel == &rightPanelDrive
			&& strlen(leftPanelDrive.path) > 0)
		{
			selectedPanel = &leftPanelDrive;
			writeSelectorPosition(&leftPanelDrive, '>');
			writeSelectorPosition(&rightPanelDrive, ' ');
			writeCurrentFilename(selectedPanel);
		}
		break;
	case CH_CURS_RIGHT:
		if(selectedPanel == &leftPanelDrive
			&& strlen(rightPanelDrive.path) > 0)
		{
			selectedPanel = &rightPanelDrive;
			writeSelectorPosition(&leftPanelDrive, ' ');
			writeSelectorPosition(&rightPanelDrive, '>');
			writeCurrentFilename(selectedPanel);
		}
		break;
#endif
	case HK_SWITCH_PANEL:
		if(selectedPanel == &leftPanelDrive
			&& strlen(rightPanelDrive.path) > 0)
		{
			selectedPanel = &rightPanelDrive;
			writeSelectorPosition(&leftPanelDrive, ' ');
			writeSelectorPosition(&rightPanelDrive, '>');
			writeCurrentFilename(selectedPanel);
		}
		else if(selectedPanel == &rightPanelDrive
			&& strlen(leftPanelDrive.path) > 0)
		{
			selectedPanel = &leftPanelDrive;
			writeSelectorPosition(&leftPanelDrive, '>');
			writeSelectorPosition(&rightPanelDrive, ' ');
			writeCurrentFilename(selectedPanel);
		}
		break;

	case KEY_SH_PLUS:
		enterDirectory(selectedPanel);
		break;
	case KEY_SH_MINUS:
	case CH_ESC:
		leaveDirectory(selectedPanel);
		break;
	//case 188: // C= C - Command Menu
	//	writeMenu(command);
	//	break;
	//case 182: // C= L - Left Menu
	//	writeMenu(left);
	//	break;
	//case 178: // C= R - Right Menu
	//	writeMenu(right);
	//	break;
	//case 187: // C= F - File Menu
	//	writeMenu(file);
	//	break;
	//case 185: // C= O - Options Menu
	//	writeMenu(options);
	//	break;
	case HK_REREAD_LEFT:
		rereadDrivePanel(left);
		break;
	case HK_REREAD_RIGHT:
		rereadDrivePanel(right);
		break;
	case HK_DRIVE_LEFT:
		writeDriveSelectionPanel(left);
		break;
	case HK_DRIVE_RIGHT:
		writeDriveSelectionPanel(right);
		break;
	case HK_SELECT_ALL:
		selectAllFiles(selectedPanel, true);
		break;
	case HK_DESELECT_ALL:
		selectAllFiles(selectedPanel, false);
		break;
	case KEY_F1:
		if(loadOverlay(1))
			writeHelpPanel();
		break;
	case KEY_F2:
		quit();
		break;
	case KEY_F5:
		if(loadOverlay(4))
			copyFiles();
		break;
	case HK_RENAME:
	case KEY_F6:
		if(loadOverlay(4))
			renameFile();
		break;
	case HK_DELETE:
	case KEY_F8:
		if(loadOverlay(4))
			deleteFiles();
		break;
	//case KEY_AT:
	//	inputCommand();
	//	break;
	case KEY_F7:
		if(loadOverlay(4))
			makeDirectory();
		break;
	case HK_TO_TOP:
		moveTop(selectedPanel);
		break;
	case HK_TO_BOTTOM:
		moveBottom(selectedPanel);
		break;
	case HK_PAGE_UP:
		movePageUp(selectedPanel);
		break;
	case HK_PAGE_DOWN:
		movePageDown(selectedPanel);
		break;
	case HK_WRITE_DISK_IMAGE:
		if(loadOverlay(3))
			writeDiskImage();
		break;
	case HK_CREATE_DISK_IMAGE:
		if(loadOverlay(3))
			createDiskImage();
		break;
	case HK_COPY_DISK:
		if(loadOverlay(2))
			copyDisk();
		break;
	default:
		//writeStatusBarf("%c", key);
		break;
	}
}