void MainWindow::AskForExit ( ) {
	int ans=wxMessageBox("Hay cambios sin aplicar al pseudocódigo.\n¿Aplicar los cambios antes de cerrar el editor?",main_window->GetTitle(),wxYES_NO|wxCANCEL|wxICON_QUESTION,this);
	if (ans==wxYES) {
		Save(); SendUpdate(MO_SAVE); Salir(true);
	} else if (ans==wxNO) {
		Salir(true);
	} else {
		return;
	}
}
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    browser_ = new WebBrowser;
    setCentralWidget(browser_);

    //this->setWindowTitle();

    main_menu_= new QMenuBar(this);
    menu_archivo_= new QMenu ("Archivo", this);
    main_menu_->addMenu(menu_archivo_);
    setMenuBar(main_menu_);

    Salir_ = new QAction("salir", this);
    menu_archivo_->addAction(Salir_);

    connect(Salir_,SIGNAL(triggered()), this, SLOT(Salir()));


    //menuBar();
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    //Create central widget and set main layout
    wgtMain_ = new QWidget(this);
    lytMain_ = new QGridLayout(wgtMain_);
    wgtMain_->setLayout(lytMain_);
    setCentralWidget(wgtMain_);

    //Initialize widgets
    mediaPlayer_  = new QMediaPlayer(this);
    playerSlider_ = new QSlider(Qt::Horizontal, this);
    videoWidget_  = new QVideoWidget(this);
    //volumeSlider_ = new QSlider(Qt::Horizontal, this);
    volumeSlider_ = new QSlider(Qt::Vertical,this);
    btnOpen_      = new QToolButton(this);
    btnPlay_      = new QToolButton(this);
    btnPause_     = new QToolButton(this);
    btnStop_      = new QToolButton(this);

    btnMinimizar_ = new QToolButton(this);
    //botones nuevos para las tareas
    btnAleatoria_ = new QToolButton(this);
    btnBucle_ = new QToolButton(this);


    //Sliders para el brillo, contraste y saturación
    brightnessSlider_ = new QSlider(Qt::Vertical);
    contrastSlider_ =   new QSlider(Qt::Vertical);
    saturavionSlider_ = new QSlider(Qt::Vertical);


    //Setup widwgets
    videoWidget_->setMinimumSize(600, 400);
    mediaPlayer_->setVideoOutput(videoWidget_);
    mediaPlayer_->setVolume(50);
    videoWidget_->setAspectRatioMode(Qt::KeepAspectRatio);
    volumeSlider_->setRange(0, 100);
    volumeSlider_->setSliderPosition(100);

    //Populate grid layout
    lytMain_->addWidget(videoWidget_,  0, 0, 1, 5);
    lytMain_->addWidget(playerSlider_, 1, 0, 1, 5);
    lytMain_->addWidget(btnOpen_,      2, 0, 1, 1);
    lytMain_->addWidget(btnPlay_,      2, 1, 1, 1);
    lytMain_->addWidget(btnPause_,     2, 2, 1, 1);
    lytMain_->addWidget(btnStop_,      2, 3, 1, 1);

    lytMain_->addWidget(btnMinimizar_, 0, 5, 1, 1);

    //botones nuevos
    lytMain_->addWidget(btnAleatoria_, 2,4,1,1);
    lytMain_->addWidget(btnBucle_, 2,5,1,1);


    lytMain_->addWidget(volumeSlider_, 2, 6, 1, 1);


    //Buttons icons
    btnOpen_->setIcon(QIcon(QPixmap(":/icons/resources/eject.png")));
    btnPause_->setIcon(QIcon(QPixmap(":/icons/resources/pause.png")));
    btnPlay_->setIcon(QIcon(QPixmap(":/icons/resources/play.png")));
    btnStop_->setIcon(QIcon(QPixmap(":/icons/resources/stop.png")));

    btnMinimizar_->setIcon(QIcon(QPixmap(":/icons/resources/minimizar.png")));

    //Buttons nuevos tareas icons
    btnAleatoria_->setIcon(QIcon(QPixmap(":/icons/resources/aleatoria.jpg")));
    btnBucle_->setIcon(QIcon(QPixmap(":/icons/resources/repetir.jpg")));

    //menu principal
    main_menu_= new QMenuBar(this);

    menu_archivo_= new QMenu ("Archivo", this);
    main_menu_->addMenu(menu_archivo_);
    setMenuBar(main_menu_);


    menu_ver_ = new QMenu ("Ver", this);
    main_menu_->addMenu(menu_ver_);
    setMenuBar(main_menu_);


    //Abrir
    Abrir_ = new QAction("Abrir", this);
    menu_archivo_->addAction(Abrir_);

    //Recientes
    Recientes_ = new QAction("Reciente", this);
    menu_archivo_->addAction(Recientes_);
    lista_recientes_ = new QListWidget();

    Cerrar_Recientes_ = new QAction("Cerrar Recientes", this);

    //rrecientes_ = new QMenu(tr("Recientes"),this);
    //rrecientes_->addAction(Recientes_);
    //menu_archivo_->addMenu(rrecientes_);
    menu_archivo_->addAction(Cerrar_Recientes_);

    Cargar_Lista_Reproduccion_ = new QAction("Cargar Lista",this);
    menu_archivo_->addAction(Cargar_Lista_Reproduccion_);


    this->setWindowIcon(QIcon(QPixmap(":/icons/resources/repro.png")));


    playlist_ = new QMediaPlaylist();


    //Ayuda
    Ayuda_ = new QAction("Ayuda", this);
    menu_archivo_->addAction(Ayuda_);


    menu_editar_ = new QMenu("Editar", this);
    main_menu_->addMenu(menu_editar_);
    Editar_ = new QAction("Imagen", this);

    menu_editar_->addAction(Editar_);


    //Ver pantalla completa
    Ver_pantalla_completa_ = new QAction("Ver_completa", this);
    Metadatas_ = new QAction("Metadata", this);
    menu_ver_->addAction(Ver_pantalla_completa_);
    menu_ver_->addAction(Metadatas_);

   // pantalla_completa_deshacer_ = new QAction(this);
   // pantalla_completa_deshacer_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));



    //salir de marcha
    Salir_ = new QAction("Salir", this);
    menu_archivo_->addAction(Salir_);



    //Connections
    connect(btnOpen_,      SIGNAL(pressed()),               this,         SLOT(onOpen()));
    connect(btnPlay_,      SIGNAL(pressed()),               mediaPlayer_, SLOT(play()));
    connect(btnPause_,     SIGNAL(pressed()),               mediaPlayer_, SLOT(pause()));
    connect(btnStop_,      SIGNAL(pressed()),               mediaPlayer_, SLOT(stop()));
    connect(playerSlider_, SIGNAL(sliderReleased()),        this,         SLOT(onSeek()));
    connect(mediaPlayer_,  SIGNAL(durationChanged(qint64)), this,         SLOT(onDurationChanged(qint64)));
    connect(mediaPlayer_,  SIGNAL(positionChanged(qint64)), this,         SLOT(onPositionChanged(qint64)));
    connect(volumeSlider_, SIGNAL(sliderMoved(int)),        this,         SLOT(onVolumeChanged(int)));

    //Connections NEW BUTTONS
    connect(btnBucle_,      SIGNAL(pressed()),              this,         SLOT(Bucle()));
    connect(btnAleatoria_,  SIGNAL(pressed()),              this,         SLOT(Aleatoria()));

    //boton minimizado
    connect(btnMinimizar_, SIGNAL(pressed()),              this,         SLOT(Minimizar()));

    //SLIDERS CONTRASTE SATURACION y BRILLO
    connect(contrastSlider_,      SIGNAL(sliderMoved(int)),               videoWidget_,         SLOT(setContrast(int)));
    connect(saturavionSlider_,      SIGNAL(sliderMoved(int)),               videoWidget_,         SLOT(setSaturation(int)));
    connect(brightnessSlider_,      SIGNAL(sliderMoved(int)),               videoWidget_,         SLOT(setBrightness(int)));


    connect(Editar_, SIGNAL(triggered()), this, SLOT(Ver_controles_edicion()) );

    //menu archivo
    connect(Abrir_, SIGNAL(triggered()), this, SLOT(Abrir()));

    connect(Recientes_, SIGNAL(triggered()), this, SLOT(Recientes_leer()));
    connect(Cerrar_Recientes_, SIGNAL(triggered()), this, SLOT(Cerrar_Recientes()));

    connect(Cargar_Lista_Reproduccion_,SIGNAL(triggered()), this, SLOT(Cargar_lista_reproduccion()));


    connect(Salir_, SIGNAL(triggered()), this, SLOT(Salir()));

    //menu ver pantalla completa
    connect(Ver_pantalla_completa_, SIGNAL(triggered()), this, SLOT(Pantalla_completa()));
    //connect(pantalla_completa_deshacer_, SIGNAL(pressed()), this, SLOT(Deshacer_pantalla_completa()));

    //METADATA
    connect(Metadatas_, SIGNAL(triggered()), this, SLOT(Ver_metadatos()));




}
void main()
{
    int Opcion = 1, Tecla;

    do
    {
        do
        {
            clrscr();
            textcolor(14); gotoxy(38, 1); printf("Pila", 162);
            textcolor(12); gotoxy(59, 25); printf("Ariel D%caz (2012-0134)", 161); gotoxy(1, 1);
            textcolor(15);
            gotoxy(1, 3); printf(Mensaje1);
            gotoxy(1, 4); printf(Mensaje2 "%co", 164);
            gotoxy(1, 5); printf(Mensaje3);
            gotoxy(1, 6); printf(Mensaje4);
            gotoxy(1, 7); printf(Mensaje5);
            gotoxy(1, 8); printf(Mensaje6 "%ca", 161);
            gotoxy(1, 9); printf(Mensaje7);
            gotoxy(1, 10); printf(Mensaje8);

            switch(Opcion)
            {
                case 1:
                    textbackground(15); textcolor(0); gotoxy(1, 3); printf(Mensaje1);
                    textbackground(0); textcolor(15);
                    break;
                case 2:
                    textbackground(15); textcolor(0); gotoxy(1, 4); printf(Mensaje2 "%co", 164);
                    textbackground(0); textcolor(15);
                    break;
                case 3:
                    textbackground(15); textcolor(0); gotoxy(1, 5); printf(Mensaje3);
                    textbackground(0); textcolor(15);
                    break;
                case 4:
                    textbackground(15); textcolor(0); gotoxy(1, 6); printf(Mensaje4);
                    textbackground(0); textcolor(15);
                    break;
                case 5:
                    textbackground(15); textcolor(0); gotoxy(1, 7); printf(Mensaje5);
                    textbackground(0); textcolor(15);
                    break;
                case 6:
                    textbackground(15); textcolor(0); gotoxy(1, 8); printf(Mensaje6 "%ca", 161);
                    textbackground(0); textcolor(15);
                    break;
                case 7:
                    textbackground(15); textcolor(0); gotoxy(1, 9); printf(Mensaje7);
                    textbackground(0); textcolor(15);
                    break;
                case 8:
                    textbackground(15); textcolor(0); gotoxy(1, 10); printf(Mensaje8);
                    textbackground(0); textcolor(15);
            }

            do
                Tecla = getch();
            while(Tecla != 13 && Tecla != 72 && Tecla != 80);

            if(Tecla == 72)
            {
                if(Opcion == 1)
                    Opcion = 8;
                else
                    if(Opcion > 1)
                        Opcion--;
            }
            else
                if(Tecla == 80)
                    if(Opcion == 8)
                        Opcion = 1;
                    else
                        if(Opcion < 8)
                            Opcion++;
        }while(Tecla != 13);

        switch(Opcion)
        {
            case 1:
                Crear();
                break;
            case 2:
                Tamagnio();
                break;
            case 3:
                Apilar();
                break;
            case 4:
                Desapilar();
                break;
            case 5:
                Cima();
                break;
            case 6:
                Vacia();
                break;
            case 7:
                Mostrar();
                break;
        }
    }while(Opcion != 8);

    Salir();
}