Esempio n. 1
0
void SymChooserImpl::accept_browser_index(int bindex) {
    int i = int(fbrowser_[bindex]->selected());
    if (i == -1) {
	return;
    }
//    i = filter_map_[i];
    SymDirectory* dir = dir_[bindex];
    const String& path = dir->path();
    const String& name = dir->name(i);
    Symbol* sym = dir->symbol(i);
    int length = path.length() + name.length();
    char* tmp = new char[length + 2];
    sprintf(
	tmp, "%.*s%.*s",
	path.length(), path.string(), name.length(), name.string()
    );
    editor_->field(tmp);
    last_selected_ = tmp;
    last_index_ = i;
    selected_ = editor_->text();
    if (dir->is_directory(i)) {
	if (chdir(bindex, i)) {
	    fchooser_->focus(editor_);
	} else {
	    /* should generate an error message */
	}
    } else {
	clear(bindex+1);
	browser_index_ = bindex;
//	fchooser_->dismiss(true);
    }
    delete [] tmp;
}
Esempio n. 2
0
void SymChooserImpl::accept_browser() {
    int bi = browser_index_;
    int i = int(fbrowser_[bi]->selected());
    if (i == -1) {
	editor_accept(editor_);
	return;
    }
//    i = filter_map_[i];
    const String& path = dir_[bi]->path();
    const String& name = dir_[bi]->name(i);
    int length = path.length() + name.length();
    char* tmp = new char[length + 1];
    sprintf(
	tmp, "%.*s%.*s",
	path.length(), path.string(), name.length(), name.string()
    );
//printf("accept_browser %s\n", tmp);
    editor_->field(tmp);
    selected_ = editor_->text();
    if (dir_[bi]->is_directory(i)) {
	if (chdir(bi, i)) {
	    fchooser_->focus(editor_);
	} else {
	    /* should generate an error message */
	}
    } else {
	fchooser_->dismiss(true);
    }
    delete [] tmp;
}
Esempio n. 3
0
void FileChooserImpl::accept_browser() {
    int i = int(fbrowser_->selected());
    if (i == -1) {
	accept_editor(editor_);
	return;
    }
    i = filter_map_[i];
    const String& path = *dir_->path();
    const String& name = *dir_->name(i);
    int length = path.length() + name.length();
    char* tmp = new char[length + 1];
    sprintf(
	tmp, "%.*s%.*s",
	path.length(), path.string(), name.length(), name.string()
    );
    editor_->field(tmp);
    selected_ = editor_->text();
    if (dir_->is_directory(i)) {
	if (chdir(String(tmp, length))) {
	    editor_->field(*dir_->path());
	    fchooser_->focus(editor_);
	} else {
	    /* should generate an error message */
	}
    } else {
	fchooser_->dismiss(true);
    }
    delete tmp;
}