コード例 #1
1
ファイル: CpDialog.cpp プロジェクト: jimmccurdy/ArchiveGit
BOOL CCpDialog::OnInitDialog()
{
	CString strAppRootFolder = GetHomeFolder() + String(GetFolderId());

	CString strContentRootFolder;
	CRegKey regkey;
	if (regkey.Open(HKEY_CURRENT_USER, REGKEY_APP) == ERROR_SUCCESS)
	{
		ULONG nLen = 255;
		char* pszValue = new char[nLen+1];

		*pszValue = 0;
		nLen = 256;
		if (regkey.QueryStringValue(REGVAL_CONTENT_FOLDER, pszValue, &nLen) == ERROR_SUCCESS)
		{
			pszValue[nLen] = 0;
			strContentRootFolder = CString(pszValue);
		}

		delete [] pszValue;
	}

	if (strContentRootFolder.IsEmpty())
		strContentRootFolder = GetHomeFolder() + String(IDS_CONTENT_FOLDER);

	DWORD dwCount = CheckForUiUpdates(strAppRootFolder);
	CheckForNewContent(strContentRootFolder, strAppRootFolder, (dwCount > 0)/*bForceCreate*/);

	// Update the variables.xsl and linelist.xml files
	SaveAppVariablesFile(strContentRootFolder, strAppRootFolder);
	SaveContentVariablesFile(strContentRootFolder, strAppRootFolder);

	CString strCaption;
	strCaption.LoadString(GetTitleId());
	SetWindowText(strCaption);

	// Initialize the url prior to calling CDHtmlDialog::OnInitDialog()
	if (m_strCurrentUrl.IsEmpty())
		m_strCurrentUrl = "about:blank";

	CDHtmlDialog::OnInitDialog();

	// This magically makes the scroll bars appear and dis-allows text selection
	DWORD dwFlags = DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_THEME | DOCHOSTUIFLAG_DIALOG; // DOCHOSTUIFLAG_NO3DOUTERBORDER;
	SetHostFlags(dwFlags);

	// Add "About..." menu item to system menu.
	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(false);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icons for this dialog
	SetIcon(m_hIcon, true);		// Set big icon
	SetIcon(m_hIcon, false);	// Set small icon

	// Set the window size and position
	CRect rect;
	rect.SetRect(0, 0, 800, 600);
	if (0) // Restore the saved window size and position
	{
		DWORD dwSize = sizeof(rect);
		regkey.QueryBinaryValue(REGVAL_LOCATION, &rect, &dwSize);

		//j Someday, clip the rect to the display
		SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_NOACTIVATE);
	}
	else
	{
		SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_NOACTIVATE);
		CenterWindow();
	}

	CString strHomePage = strAppRootFolder + String(IDS_HOME_PAGE);
	if (FileExists(strHomePage))
		Navigate(strHomePage);

	ShowWindow(SW_NORMAL);

	DragAcceptFiles(false);

	return true;  // return TRUE  unless you set the focus to a control
}
コード例 #2
0
ファイル: MainFrm.cpp プロジェクト: zxlooong/bcgexp
// these all go to specific web pages, just like Internet Explorer's help menu
void CMainFrame::OnHelpWebTutorial()
{
    CString str;
    str.LoadString(IDS_HELP_WEB_TUTORIAL);
    Navigate (str);
}
コード例 #3
0
ファイル: MainFrm.cpp プロジェクト: zxlooong/bcgexp
void CMainFrame::OnFavorite(UINT nID)
{
    Navigate (theApp.m_Favorites.GetURLofID (nID));
    SetFocus ();
}
コード例 #4
0
ファイル: IEBrowserEngine.cpp プロジェクト: gaurav1981/rhodes
BOOL CIEBrowserEngine::BackOnTab(int iInstID,int iPagesBack /*= 1*/)
{
    return Navigate(L"history:back", 0);
}
コード例 #5
0
ファイル: Grid.cpp プロジェクト: tuanmasterit/audacity
void Grid::OnKeyDown(wxKeyEvent &event)
{
   switch (event.GetKeyCode())
   {
      case WXK_LEFT:
      case WXK_RIGHT:
      {
         int rows = GetNumberRows();
         int cols = GetNumberCols();
         int crow = GetGridCursorRow();
         int ccol = GetGridCursorCol();

         if (event.GetKeyCode() == WXK_LEFT) {
            if (crow == 0 && ccol == 0) {
               // do nothing
            }
            else if (ccol == 0) {
               SetGridCursor(crow - 1, cols - 1);
            }
            else {
               SetGridCursor(crow, ccol - 1);
            }
         }
         else {
            if (crow == rows - 1 && ccol == cols - 1) {
               // do nothing
            }
            else if (ccol == cols - 1) {
               SetGridCursor(crow + 1, 0);
            }
            else {
               SetGridCursor(crow, ccol + 1);
            }
         }

#if wxUSE_ACCESSIBILITY
         // Make sure the new cell is made available to the screen reader
         mAx->SetCurrentCell(GetGridCursorRow(), GetGridCursorCol());
#endif
      }
      break;

      case WXK_TAB:
      {
         int rows = GetNumberRows();
         int cols = GetNumberCols();
         int crow = GetGridCursorRow();
         int ccol = GetGridCursorCol();

         if (event.ControlDown()) {
            int flags = wxNavigationKeyEvent::FromTab |
                        ( event.ShiftDown() ?
                          wxNavigationKeyEvent::IsBackward :
                          wxNavigationKeyEvent::IsForward );
            Navigate(flags);
            return;
         }
         else if (event.ShiftDown()) {
            if (crow == 0 && ccol == 0) {
               Navigate(wxNavigationKeyEvent::FromTab | wxNavigationKeyEvent::IsBackward);
               return;
            }
            else if (ccol == 0) {
               SetGridCursor(crow - 1, cols - 1);
            }
            else {
               SetGridCursor(crow, ccol - 1);
            }
         }
         else {
            if (crow == rows - 1 && ccol == cols - 1) {
               Navigate(wxNavigationKeyEvent::FromTab | wxNavigationKeyEvent::IsForward);
               return;
            }
            else if (ccol == cols - 1) {
               SetGridCursor(crow + 1, 0);
            }
            else {
               SetGridCursor(crow, ccol + 1);
            }
         }
         MakeCellVisible(GetGridCursorRow(), GetGridCursorCol());

#if wxUSE_ACCESSIBILITY
         // Make sure the new cell is made available to the screen reader
         mAx->SetCurrentCell(GetGridCursorRow(), GetGridCursorCol());
#endif
      }
      break;

      case WXK_RETURN:
      case WXK_NUMPAD_ENTER:
      {
         if (!IsCellEditControlShown()) {
            wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
            wxWindow *def = tlw->GetDefaultItem();
            if (def && def->IsEnabled()) {
               wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED,
                                     def->GetId());
               GetParent()->ProcessEvent(cevent);
            }
         }
         else {
            wxGrid::OnKeyDown(event);

            // This looks strange, but what it does is selects the cell when
            // enter is pressed after editing.  Without it, Jaws and Window-Eyes
            // do not speak the new cell contents (the one below the edited one).
            SetGridCursor(GetGridCursorRow(), GetGridCursorCol());
         }
         break;
      }

      default:
         wxGrid::OnKeyDown(event);
      break;
   }
}
コード例 #6
0
void wxTextCtrl::OnChar(wxKeyEvent& event)
{
    int key = event.GetKeyCode() ;
    bool eat_key = false ;
    long from, to;

    if ( !IsEditable() && !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB) &&
        !( key == WXK_RETURN && ( (m_windowStyle & wxTE_PROCESS_ENTER) || (m_windowStyle & wxTE_MULTILINE) ) )
//        && key != WXK_PAGEUP && key != WXK_PAGEDOWN && key != WXK_HOME && key != WXK_END
        )
    {
        // eat it
        return ;
    }

    // Check if we have reached the max # of chars (if it is set), but still
    // allow navigation and deletion
    GetSelection( &from, &to );
    if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength &&
        !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) &&
        !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) &&
        from == to )
    {
        // eat it, we don't want to add more than allowed # of characters

        // TODO: generate EVT_TEXT_MAXLEN()
        return;
    }

    // assume that any key not processed yet is going to modify the control
    m_dirty = true;

    switch ( key )
    {
        case WXK_RETURN:
            if (m_windowStyle & wxTE_PROCESS_ENTER)
            {
                wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
                event.SetEventObject( this );
                event.SetString( GetValue() );
                if ( HandleWindowEvent(event) )
                    return;
            }

            if ( !(m_windowStyle & wxTE_MULTILINE) )
            {
                wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
                if ( tlw && tlw->GetDefaultItem() )
                {
                    wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
                    if ( def && def->IsEnabled() )
                    {
                        wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
                        event.SetEventObject(def);
                        def->Command(event);

                        return ;
                    }
                }

                // this will make wxWidgets eat the ENTER key so that
                // we actually prevent line wrapping in a single line text control
                eat_key = true;
            }
            break;

        case WXK_TAB:
            if ( !(m_windowStyle & wxTE_PROCESS_TAB))
            {
                int flags = 0;
                if (!event.ShiftDown())
                    flags |= wxNavigationKeyEvent::IsForward ;
                if (event.ControlDown())
                    flags |= wxNavigationKeyEvent::WinChange ;
                Navigate(flags);

                return;
            }
            else
            {
                // This is necessary (don't know why);
                // otherwise the tab will not be inserted.
                WriteText(wxT("\t"));
                eat_key = true;
            }
            break;

        default:
            break;
    }

    if (!eat_key)
    {
        // perform keystroke handling
        event.Skip(true) ;
    }

    // osx_cocoa sends its event upon insertText
#if wxOSX_USE_CARBON
    if ( ( key >= 0x20 && key < WXK_START ) ||
         ( key >= WXK_NUMPAD0 && key <= WXK_DIVIDE ) ||
         key == WXK_RETURN ||
         key == WXK_DELETE ||
         key == WXK_BACK)
    {
        wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
        event1.SetEventObject( this );
        wxPostEvent( GetEventHandler(), event1 );
    }
#endif
}
コード例 #7
0
void CWtlHtmlView::Clear()
{
	if (m_spWebBrowser2 != NULL) {

		// if document interface available, close/re-open document to clear display

		IHTMLDocument2	*document	= GetDocument();
		HRESULT			hr			= S_OK;
		
		if (document != NULL) {

			// close and re-open document to empty contents

			document->close();
			
			VARIANT		open_name;
			VARIANT		open_features;
			VARIANT		open_replace;
			IDispatch	*open_window	= NULL;

			::VariantInit(&open_name);

			open_name.vt      = VT_BSTR;
			open_name.bstrVal = ::SysAllocString(L"_self");

			::VariantInit(&open_features);
			::VariantInit(&open_replace);
			
			hr = document->open(::SysAllocString(L"text/html"),
			                    open_name,
			                    open_features,
			                    open_replace,
			                    &open_window);

			if (hr == S_OK) {
				Refresh();
			}

			if (open_window != NULL) {
				open_window->Release();
			}

		}

		// otherwise, navigate to about:blank and wait for document ready

		else {

			Navigate(_T("about:blank"));

			IHTMLDocument2 *document = NULL;
			HRESULT			hr       = S_OK;

			while ((document == NULL) && (hr == S_OK)) {

				Sleep(0);

				IDispatch *document_dispatch = NULL;

				hr = m_spWebBrowser2->get_Document(&document_dispatch);

				// if dispatch interface available, retrieve document interface
				
				if (SUCCEEDED(hr) && (document_dispatch != NULL)) {

					// retrieve document interface
					
					hr = document_dispatch->QueryInterface(IID_IHTMLDocument2,(void **)&document);

					document_dispatch->Release();

				}
				
			}
			
			if (document != NULL) {
				document->Release();	
			}

		}
		
	}
}
コード例 #8
0
ファイル: HtmlDlg.cpp プロジェクト: lvshuchengyin/mycode
void HtmlDlg::GotoUrl( CString url)
{
	Navigate( url );
}
コード例 #9
0
ファイル: MiniPieFrame.cpp プロジェクト: Bizonu/amclibrary
bool CMiniPieFrame::AppNewInstance(LPCTSTR lpstrCmdLine)
{
	Navigate(lpstrCmdLine);
	return true;
}
コード例 #10
0
BOOL CWorkspaceDialog::OnInitDialog()
{
	CString strCaption;
	strCaption.LoadString(GetTitleId());
	if (!m_strName.IsEmpty())
		strCaption += " " + m_strName;
	SetWindowText(strCaption);

	// Initialize the url prior to calling CDHtmlDialog::OnInitDialog()
	if (m_strCurrentUrl.IsEmpty())
		m_strCurrentUrl = "about:blank";

	CDHtmlDialog::OnInitDialog();
	m_bUseHtmlTitle = false;

	// This magically makes the scroll bars appear and dis-allows text selection
	DWORD dwFlags = DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_THEME | DOCHOSTUIFLAG_DIALOG; // DOCHOSTUIFLAG_NO3DOUTERBORDER;
	SetHostFlags(dwFlags);

	// Add "About..." menu item to system menu.
	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(false);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icons for this dialog
	SetIcon(m_hIcon, true);		// Set big icon
	SetIcon(m_hIcon, false);	// Set small icon

	// Set the window size and position
	if (!m_pRect)
		CenterWindow();
	else
	{
		CRect Rect = *m_pRect;
		SetWindowPos(NULL, Rect.left, Rect.top, Rect.Width(), Rect.Height(), SWP_NOZORDER | SWP_NOACTIVATE);
	}

	// Copy this to CpDialog.cpp
	if (m_pBrowserApp)
	{
		m_pBrowserApp->put_RegisterAsDropTarget(VARIANT_FALSE);
		m_pBrowserApp->put_ToolBar(VARIANT_FALSE);
		m_pBrowserApp->put_StatusBar(VARIANT_TRUE);
		m_pBrowserApp->put_MenuBar(VARIANT_FALSE);
		m_pBrowserApp->put_Resizable(VARIANT_TRUE);
		m_pBrowserApp->put_AddressBar(VARIANT_FALSE);
	}

	Navigate(m_strUrl, navNoHistory/*dwFlags*/, "_self"/*lpszTargetFrameName*/, NULL/*lpszHeaders*/, NULL/*lpvPostData*/, 0/*dwPostDataLen*/);

	// Wait until the page is loaded
	if (m_pBrowserApp)
	{
		VARIANT_BOOL bBusy = true; // Initialize this to true if you want to wait for the document to load
		int i = 300;
		while (bBusy)
		{
			::Sleep(100);
			m_pBrowserApp->get_Busy(&bBusy);
			if (--i <= 0)
				break;
		}
	}

	ShowWindow(SW_NORMAL);

	DragAcceptFiles(false);

	return true;  // return TRUE  unless you set the focus to a control
}
コード例 #11
0
BOOL CIEBrowserEngine::ReloadOnTab(bool bFromCache, UINT iTab)
{
    if(m_currentPage!=NULL)
    	Navigate(m_currentPage->tcURL,iTab);
    return TRUE; 
}
コード例 #12
0
BOOL CIEBrowserEngine::Navigate(LPCTSTR tcURL, int iTabID)
{
    //  On Windows Mobile devices it has been observed that attempting to 
    //  navigate to a Javascript function before the page is fully loaded can 
    //  crash PocketBrowser (specifically when using Reload).  This condition
    //  prevents that behaviour.
    
    if (!m_bLoadingComplete && (wcsnicmp(tcURL, L"JavaScript:", wcslen(L"JavaScript:")) == 0))
    {
        LOG(TRACE) + "Failed to Navigate, Navigation in Progress\n";
        return S_FALSE;
    }

    LRESULT retVal = S_FALSE;

    if (wcsicmp(tcURL, L"history:back") == 0)
    {
		TCHAR tcPreviousURL[MAX_URL];
		LOG(INFO) + "\nDRD history:back tcURL="+tcURL;
		GetPreviousUrl(tcPreviousURL);
		Navigate(tcPreviousURL, iTabID);
		return S_OK;
    }

        //  Engine component does not accept Navigate(page.html), it needs
        //  the absolute URL of the page, add that here (if the user puts a .\ before)
        TCHAR tcDereferencedURL[MAX_URL];
        memset(tcDereferencedURL, 0, MAX_URL * sizeof(TCHAR));
        if (rho::browser::IsRelativeURL(tcURL))
        {
            if (!rho::browser::DereferenceURL(tcURL, tcDereferencedURL, m_tcNavigatedURL))
                return S_FALSE;
        }
        else
            wcscpy(tcDereferencedURL, tcURL);

        //  Test to see if the navigation URL starts with a '\', if it does
        //  then prepend 'file://'
        if (tcDereferencedURL[0] == L'\\')
        {
            if (wcslen(tcDereferencedURL) <= (MAX_URL - wcslen(L"file://")))
            {
                TCHAR tcNewURL[MAX_URL + 1];
                wsprintf(tcNewURL, L"file://%s", tcDereferencedURL);
                retVal = SendMessage(m_hwndTabHTML, DTM_NAVIGATE, 0, (LPARAM) (LPCTSTR)tcNewURL);
            }
        }
        else if (wcslen(tcDereferencedURL) > wcslen(L"www") && wcsnicmp(tcURL, L"www", 3) == 0)
        {
            if (wcslen(tcDereferencedURL) <= (MAX_URL - wcslen(L"http://")))
            {
                TCHAR tcNewURL[MAX_URL + 1];
                wsprintf(tcNewURL, L"http://%s", tcDereferencedURL);
                retVal = SendMessage(m_hwndTabHTML, DTM_NAVIGATE, 0, (LPARAM) (LPCTSTR)tcNewURL);
            }
        }
        else
            retVal = SendMessage(m_hwndTabHTML, DTM_NAVIGATE, 0, (LPARAM) (LPCTSTR)tcDereferencedURL);
    

    return retVal;
}
コード例 #13
0
ファイル: moaLb.c プロジェクト: mhelal/mmDST
int main (int argc, char ** argv) {
  MOA_rec * MOA1 = NULL; 
  MOA_rec * MOA2 = NULL;

  long * shape = NULL;
  long * ind = NULL;
  long * ind2 = NULL;
  long flatIndex;
  long i, rslt_ub, strides; 
  int finished = 1;
  long * rslt = NULL;
  long * rsltInd = NULL;

  /*open once to erase previous contents then close */
  outputfilename = "moamsa.out";
  if (( outfile= fopen (outputfilename, "w")) == NULL) {
    printf("Can not Open output file, exiting.\n");
    return;
  }
  fclose(outfile);
  createMOAStruct(&MOA1);
  ind = (long *) mmalloc ( MOA1->dimn * sizeof(long));
  ind2 = (long *) mmalloc ( MOA1->dimn * sizeof(long));
  finished = 1;
  while (finished != 0) {
    switch (finished) {
    case 0:
    default:
      printf("\n Good Bye\n");
      break;
    case 1:     
      deleteMOA (MOA1); 
	  MOA1 = NULL;
      free(ind);
	  ind = NULL;
      free(ind2);
	  ind2 = NULL;
      createMOAStruct(&MOA1);
      printf ("\nEnter dimensionality:");
      scanf("%ld", & MOA1->dimn);
      ind = (long *) mmalloc ( MOA1->dimn * sizeof(long));
      ind2 = (long *) mmalloc ( MOA1->dimn * sizeof(long));
      shape = (long *) mmalloc ( MOA1->dimn * sizeof(long));
      for (i = 0; i < MOA1->dimn; i++) {
	    printf ("\nEnter shape at dimension %ld:", i);
	    scanf("%ld", &shape[i]);
      }

      createMOA(shape /* shape*/, MOA1->dimn /* dimension*/, MOA1 /* MOA structure*/, -1, 0);
      /*printMOA(MOA1); // we didn't create the tensor to print it*/
      printf("created the MOA\n");
      break;
    case 2:     
      printMOA(MOA1);
      break;
    case 3:
      for (i = 0; i < MOA1->dimn; i++) {
	printf ("\nEnter index at dimn %ld:", i);
	scanf("%ld", &ind[i]);
      }
      
      flatIndex = Gamma(ind, MOA1->dimn, shape,  MOA1->dimn, 1);
      printf("\n the flatIndex = %ld \n", flatIndex);
      break;
    case 4:
      printf ("\nEnter flat index :" );
      scanf("%ld", &flatIndex);
      Gamma_Inverse(flatIndex, shape,  MOA1->dimn, ind);
      for (i = 0; i < MOA1->dimn; i++) {
	printf("%ld", ind[i]);
      }
      break;
    case 5:
      MOA2 = (MOA_rec *) mmalloc(sizeof(MOA_rec));
      for (i = 0; i <  MOA1->dimn; i++) {
	    printf ("\nEnter take index at dimn %ld:", i);
	    scanf("%ld", &ind[i]);
      }
      Take (ind, MOA1->dimn, MOA1, MOA2);
      printMOA(MOA2);
      
      deleteMOA (MOA2);  
	  MOA2 = NULL;
      break;
    case 6:
      MOA2 = (MOA_rec *) mmalloc(sizeof(MOA_rec));
      for (i = 0; i <  MOA1->dimn; i++) {
	    printf ("\nEnter Drop index at dimn %ld:", i);
	    scanf("%ld", &ind[i]);
      }
      Drop (ind, MOA1->dimn, MOA1, MOA2);
      printMOA(MOA2);
      deleteMOA (MOA2);  
	  MOA2 = NULL;
     break;
      /* case 5:
      printf ("\nEnter flat index :" );
      scanf("%d", &flatIndex);
      Gamma_Inverse(flatIndex, shape,  MOA1->dimn, ind);
      LNghbCount  = GetLowerNeighbors ( MOA1->dimn, shape, ind, &lNeighbors);
      printf("\n Has %d Neighbors :", LNghbCount);
      for (i = 0; i < LNghbCount; i++) {
	printf(" %d ", lNeighbors[i]);
      }
      break;*/
    case 7:
      MOA2 = (MOA_rec *) mmalloc(sizeof(MOA_rec));
      for (i = 0; i <  MOA1->dimn; i++) {
	    printf ("\nEnter Cell index at dimn %ld:", i);
	    scanf("%ld", &ind[i]);
      }
      MOAGetLowerNeighbors (ind, MOA1, MOA2);
      printMOA(MOA2);
      
      printf("With Indices ");
      for (i=0;i<MOA2->elements_ub; i++)
	    printf("%ld ", MOA2->indexes[i]);
      printf("\n");
      deleteMOA (MOA2); 
	  MOA2 = NULL;
     break;
    case 8:
      MOA2 = (MOA_rec *) mmalloc(sizeof(MOA_rec));
      for (i = 0; i <  MOA1->dimn; i++) {
	    printf ("\nEnter Cell index at dimn %ld:", i);
	    scanf("%ld", &ind[i]);
      }
      printf ("\nEnter The Stride Size:");
      scanf("%ld", &flatIndex);
      MOAGetHigherNeighbors (flatIndex, ind, MOA1, MOA2);
      printMOA(MOA2);
      
      printf("With Indices ");
      for (i=0;i<MOA2->elements_ub; i++)
	     printf("%ld ", MOA2->indexes[i]);
      printf("\n");
      deleteMOA (MOA2);
	  MOA2 = NULL;
     break;
    case 9:
      printf ("\nEnter The Size of the Wave:");
      scanf("%ld", &flatIndex);
      for (i = 0; i <  MOA1->dimn; i++) {
	    ind[i] = 1;
      }
      getDiagonals (1, flatIndex, ind, MOA1);
     break;
    case 99:
      for (i = 0; i <  MOA1->dimn; i++) {
	    printf ("\nEnter Navigation Director at dimn %ld:", i);
	    scanf("%ld", &ind[i]);
      }
      for (i = 0; i <  MOA1->dimn; i++) {
	    printf ("\nEnter Starting Cell index at dimn %ld:", i);
	    scanf("%ld", &ind2[i]);
      }
      printf ("\nEnter Strides: ");
      scanf("%ld", &strides);
      
      Navigate (ind, strides, ind2, MOA1, &rslt, &rsltInd, &rslt_ub);
      printf("rslt_ub = %ld \n", rslt_ub);
      
      for (i=0;i<rslt_ub; i++)
      	printf("%ld at %ld \n", rslt[i],rsltInd [i]);
      printf("\n");
      free(rslt);
	  rslt = NULL;
      free(rsltInd);
	  rsltInd = NULL;
      break;

    }
    printf ("\n1: Re-Define MOA\n");
    printf ("2: Print MOA\n");
    printf ("3: Gamma\n");
    printf ("4: Gamma_inverse\n");
    printf ("5: Take\n");
    printf ("6: Drop\n");
    printf ("7: MOAGetLowerNeighbors\n");
    printf ("8: MOAGetHigherNeighbors\n");
    printf ("9: GetDiagonals\n");
    printf ("0: Quit\n");
    printf ("\nEnter op code:" );
    scanf("%d", &finished);
    if (finished == 0) 
      printf("\n Good Bye\n");
  }
  free(ind);
  free(ind2);
  deleteMOA (MOA1);  
}