void ParticleRender::drawParticles(const ParticleList &particles) { ci::gl::ScopedTextureBind stb(mTexture); // Prevent writing to the depth buffer, which will block out // pixels that are supposed to be transparent. ci::gl::ScopedDepthWrite sdw(false); ci::gl::ScopedBlendAlpha sba; ci::gl::color(1.0f, 1.0f, 1.0f, 1.0f); size_t k = 0, size = particles.size(); while (size >= BUFFER_SIZE) { drawParticles(k, k + BUFFER_SIZE, particles); k += BUFFER_SIZE; size -= BUFFER_SIZE; } drawParticles(k, particles.size(), particles); }
//-----------------------------------------------------------------// bool unzip::open(const std::string& archive) { close(); hnd_ = unzOpen(archive.c_str()); if(hnd_ == 0) { return false; } do { file_info fi; char fn[2048]; fn[0] = 0; if(unzGetCurrentFileInfo(hnd_, &fi.info_, fn, sizeof(fn), NULL, 0, NULL, 0) != UNZ_OK) { break; } const char* p = strrchr(fn, '/'); if(p != 0 && p[1] == 0) { // 最後の文字が「/」で終わる場合はアーカイブに含めない dirs_.push_back(fn); } else { fi.ofs_ = unzGetOffset(hnd_); fi.path_ = fn; zmap::iterator it = zmap_.find(fn); if(it == zmap_.end()) { zmap::value_type stb(fn, files_.size()); zmap_.insert(stb); files_.push_back(fi); } else { files_[it->second] = fi; } } } while(unzGoToNextFile(hnd_) != UNZ_END_OF_LIST_OF_FILE) ; zname_ = archive; return true; }
OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { OopMapSet* oop_maps = NULL; // for better readability const bool must_gc_arguments = true; const bool dont_gc_arguments = false; // stub code & info for the different stubs switch (id) { case forward_exception_id: { oop_maps = generate_handle_exception(id, sasm); } break; case new_instance_id: case fast_new_instance_id: case fast_new_instance_init_check_id: { Register G5_klass = G5; // Incoming Register O0_obj = O0; // Outgoing if (id == new_instance_id) { __ set_info("new_instance", dont_gc_arguments); } else if (id == fast_new_instance_id) { __ set_info("fast new_instance", dont_gc_arguments); } else { assert(id == fast_new_instance_init_check_id, "bad StubID"); __ set_info("fast new_instance init check", dont_gc_arguments); } if ((id == fast_new_instance_id || id == fast_new_instance_init_check_id) && UseTLAB && FastTLABRefill) { Label slow_path; Register G1_obj_size = G1; Register G3_t1 = G3; Register G4_t2 = G4; assert_different_registers(G5_klass, G1_obj_size, G3_t1, G4_t2); // Push a frame since we may do dtrace notification for the // allocation which requires calling out and we don't want // to stomp the real return address. __ save_frame(0); if (id == fast_new_instance_init_check_id) { // make sure the klass is initialized __ ldub(G5_klass, in_bytes(InstanceKlass::init_state_offset()), G3_t1); __ cmp_and_br_short(G3_t1, InstanceKlass::fully_initialized, Assembler::notEqual, Assembler::pn, slow_path); } #ifdef ASSERT // assert object can be fast path allocated { Label ok, not_ok; __ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size); // make sure it's an instance (LH > 0) __ cmp_and_br_short(G1_obj_size, 0, Assembler::lessEqual, Assembler::pn, not_ok); __ btst(Klass::_lh_instance_slow_path_bit, G1_obj_size); __ br(Assembler::zero, false, Assembler::pn, ok); __ delayed()->nop(); __ bind(not_ok); __ stop("assert(can be fast path allocated)"); __ should_not_reach_here(); __ bind(ok); } #endif // ASSERT // if we got here then the TLAB allocation failed, so try // refilling the TLAB or allocating directly from eden. Label retry_tlab, try_eden; __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves G5_klass __ bind(retry_tlab); // get the instance size __ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size); __ tlab_allocate(O0_obj, G1_obj_size, 0, G3_t1, slow_path); __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2); __ verify_oop(O0_obj); __ mov(O0, I0); __ ret(); __ delayed()->restore(); __ bind(try_eden); // get the instance size __ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size); __ eden_allocate(O0_obj, G1_obj_size, 0, G3_t1, G4_t2, slow_path); __ incr_allocated_bytes(G1_obj_size, G3_t1, G4_t2); __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2); __ verify_oop(O0_obj); __ mov(O0, I0); __ ret(); __ delayed()->restore(); __ bind(slow_path); // pop this frame so generate_stub_call can push it's own __ restore(); } oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_instance), G5_klass); // I0->O0: new instance } break; case counter_overflow_id: // G4 contains bci, G5 contains method oop_maps = generate_stub_call(sasm, noreg, CAST_FROM_FN_PTR(address, counter_overflow), G4, G5); break; case new_type_array_id: case new_object_array_id: { Register G5_klass = G5; // Incoming Register G4_length = G4; // Incoming Register O0_obj = O0; // Outgoing Address klass_lh(G5_klass, Klass::layout_helper_offset()); assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise"); assert(Klass::_lh_header_size_mask == 0xFF, "bytewise"); // Use this offset to pick out an individual byte of the layout_helper: const int klass_lh_header_size_offset = ((BytesPerInt - 1) // 3 - 2 selects byte {0,1,0,0} - Klass::_lh_header_size_shift / BitsPerByte); if (id == new_type_array_id) { __ set_info("new_type_array", dont_gc_arguments); } else { __ set_info("new_object_array", dont_gc_arguments); } #ifdef ASSERT // assert object type is really an array of the proper kind { Label ok; Register G3_t1 = G3; __ ld(klass_lh, G3_t1); __ sra(G3_t1, Klass::_lh_array_tag_shift, G3_t1); int tag = ((id == new_type_array_id) ? Klass::_lh_array_tag_type_value : Klass::_lh_array_tag_obj_value); __ cmp_and_brx_short(G3_t1, tag, Assembler::equal, Assembler::pt, ok); __ stop("assert(is an array klass)"); __ should_not_reach_here(); __ bind(ok); } #endif // ASSERT if (UseTLAB && FastTLABRefill) { Label slow_path; Register G1_arr_size = G1; Register G3_t1 = G3; Register O1_t2 = O1; assert_different_registers(G5_klass, G4_length, G1_arr_size, G3_t1, O1_t2); // check that array length is small enough for fast path __ set(C1_MacroAssembler::max_array_allocation_length, G3_t1); __ cmp_and_br_short(G4_length, G3_t1, Assembler::greaterUnsigned, Assembler::pn, slow_path); // if we got here then the TLAB allocation failed, so try // refilling the TLAB or allocating directly from eden. Label retry_tlab, try_eden; __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves G4_length and G5_klass __ bind(retry_tlab); // get the allocation size: (length << (layout_helper & 0x1F)) + header_size __ ld(klass_lh, G3_t1); __ sll(G4_length, G3_t1, G1_arr_size); __ srl(G3_t1, Klass::_lh_header_size_shift, G3_t1); __ and3(G3_t1, Klass::_lh_header_size_mask, G3_t1); __ add(G1_arr_size, G3_t1, G1_arr_size); __ add(G1_arr_size, MinObjAlignmentInBytesMask, G1_arr_size); // align up __ and3(G1_arr_size, ~MinObjAlignmentInBytesMask, G1_arr_size); __ tlab_allocate(O0_obj, G1_arr_size, 0, G3_t1, slow_path); // preserves G1_arr_size __ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2); __ ldub(klass_lh, G3_t1, klass_lh_header_size_offset); __ sub(G1_arr_size, G3_t1, O1_t2); // body length __ add(O0_obj, G3_t1, G3_t1); // body start __ initialize_body(G3_t1, O1_t2); __ verify_oop(O0_obj); __ retl(); __ delayed()->nop(); __ bind(try_eden); // get the allocation size: (length << (layout_helper & 0x1F)) + header_size __ ld(klass_lh, G3_t1); __ sll(G4_length, G3_t1, G1_arr_size); __ srl(G3_t1, Klass::_lh_header_size_shift, G3_t1); __ and3(G3_t1, Klass::_lh_header_size_mask, G3_t1); __ add(G1_arr_size, G3_t1, G1_arr_size); __ add(G1_arr_size, MinObjAlignmentInBytesMask, G1_arr_size); __ and3(G1_arr_size, ~MinObjAlignmentInBytesMask, G1_arr_size); __ eden_allocate(O0_obj, G1_arr_size, 0, G3_t1, O1_t2, slow_path); // preserves G1_arr_size __ incr_allocated_bytes(G1_arr_size, G3_t1, O1_t2); __ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2); __ ldub(klass_lh, G3_t1, klass_lh_header_size_offset); __ sub(G1_arr_size, G3_t1, O1_t2); // body length __ add(O0_obj, G3_t1, G3_t1); // body start __ initialize_body(G3_t1, O1_t2); __ verify_oop(O0_obj); __ retl(); __ delayed()->nop(); __ bind(slow_path); } if (id == new_type_array_id) { oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_type_array), G5_klass, G4_length); } else { oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_object_array), G5_klass, G4_length); } // I0 -> O0: new array } break; case new_multi_array_id: { // O0: klass // O1: rank // O2: address of 1st dimension __ set_info("new_multi_array", dont_gc_arguments); oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_multi_array), I0, I1, I2); // I0 -> O0: new multi array } break; case register_finalizer_id: { __ set_info("register_finalizer", dont_gc_arguments); // load the klass and check the has finalizer flag Label register_finalizer; Register t = O1; __ load_klass(O0, t); __ ld(t, in_bytes(Klass::access_flags_offset()), t); __ set(JVM_ACC_HAS_FINALIZER, G3); __ andcc(G3, t, G0); __ br(Assembler::notZero, false, Assembler::pt, register_finalizer); __ delayed()->nop(); // do a leaf return __ retl(); __ delayed()->nop(); __ bind(register_finalizer); OopMap* oop_map = save_live_registers(sasm); int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, SharedRuntime::register_finalizer), I0); oop_maps = new OopMapSet(); oop_maps->add_gc_map(call_offset, oop_map); // Now restore all the live registers restore_live_registers(sasm); __ ret(); __ delayed()->restore(); } break; case throw_range_check_failed_id: { __ set_info("range_check_failed", dont_gc_arguments); // arguments will be discarded // G4: index oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_range_check_exception), true); } break; case throw_index_exception_id: { __ set_info("index_range_check_failed", dont_gc_arguments); // arguments will be discarded // G4: index oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_index_exception), true); } break; case throw_div0_exception_id: { __ set_info("throw_div0_exception", dont_gc_arguments); oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_div0_exception), false); } break; case throw_null_pointer_exception_id: { __ set_info("throw_null_pointer_exception", dont_gc_arguments); oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_null_pointer_exception), false); } break; case handle_exception_id: { __ set_info("handle_exception", dont_gc_arguments); oop_maps = generate_handle_exception(id, sasm); } break; case handle_exception_from_callee_id: { __ set_info("handle_exception_from_callee", dont_gc_arguments); oop_maps = generate_handle_exception(id, sasm); } break; case unwind_exception_id: { // O0: exception // I7: address of call to this method __ set_info("unwind_exception", dont_gc_arguments); __ mov(Oexception, Oexception->after_save()); __ add(I7, frame::pc_return_offset, Oissuing_pc->after_save()); __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), G2_thread, Oissuing_pc->after_save()); __ verify_not_null_oop(Oexception->after_save()); // Restore SP from L7 if the exception PC is a method handle call site. __ mov(O0, G5); // Save the target address. __ lduw(Address(G2_thread, JavaThread::is_method_handle_return_offset()), L0); __ tst(L0); // Condition codes are preserved over the restore. __ restore(); __ jmp(G5, 0); __ delayed()->movcc(Assembler::notZero, false, Assembler::icc, L7_mh_SP_save, SP); // Restore SP if required. } break; case throw_array_store_exception_id: { __ set_info("throw_array_store_exception", dont_gc_arguments); oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true); } break; case throw_class_cast_exception_id: { // G4: object __ set_info("throw_class_cast_exception", dont_gc_arguments); oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_class_cast_exception), true); } break; case throw_incompatible_class_change_error_id: { __ set_info("throw_incompatible_class_cast_exception", dont_gc_arguments); oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_incompatible_class_change_error), false); } break; case slow_subtype_check_id: { // Support for uint StubRoutine::partial_subtype_check( Klass sub, Klass super ); // Arguments : // // ret : G3 // sub : G3, argument, destroyed // super: G1, argument, not changed // raddr: O7, blown by call Label miss; __ save_frame(0); // Blow no registers! __ check_klass_subtype_slow_path(G3, G1, L0, L1, L2, L4, NULL, &miss); __ mov(1, G3); __ ret(); // Result in G5 is 'true' __ delayed()->restore(); // free copy or add can go here __ bind(miss); __ mov(0, G3); __ ret(); // Result in G5 is 'false' __ delayed()->restore(); // free copy or add can go here } case monitorenter_nofpu_id: case monitorenter_id: { // G4: object // G5: lock address __ set_info("monitorenter", dont_gc_arguments); int save_fpu_registers = (id == monitorenter_id); // make a frame and preserve the caller's caller-save registers OopMap* oop_map = save_live_registers(sasm, save_fpu_registers); int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorenter), G4, G5); oop_maps = new OopMapSet(); oop_maps->add_gc_map(call_offset, oop_map); restore_live_registers(sasm, save_fpu_registers); __ ret(); __ delayed()->restore(); } break; case monitorexit_nofpu_id: case monitorexit_id: { // G4: lock address // note: really a leaf routine but must setup last java sp // => use call_RT for now (speed can be improved by // doing last java sp setup manually) __ set_info("monitorexit", dont_gc_arguments); int save_fpu_registers = (id == monitorexit_id); // make a frame and preserve the caller's caller-save registers OopMap* oop_map = save_live_registers(sasm, save_fpu_registers); int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorexit), G4); oop_maps = new OopMapSet(); oop_maps->add_gc_map(call_offset, oop_map); restore_live_registers(sasm, save_fpu_registers); __ ret(); __ delayed()->restore(); } break; case deoptimize_id: { __ set_info("deoptimize", dont_gc_arguments); OopMap* oop_map = save_live_registers(sasm); int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize)); oop_maps = new OopMapSet(); oop_maps->add_gc_map(call_offset, oop_map); restore_live_registers(sasm); DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob(); assert(deopt_blob != NULL, "deoptimization blob must have been created"); AddressLiteral dest(deopt_blob->unpack_with_reexecution()); __ jump_to(dest, O0); __ delayed()->restore(); } break; case access_field_patching_id: { __ set_info("access_field_patching", dont_gc_arguments); oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, access_field_patching)); } break; case load_klass_patching_id: { __ set_info("load_klass_patching", dont_gc_arguments); oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_klass_patching)); } break; case load_mirror_patching_id: { __ set_info("load_mirror_patching", dont_gc_arguments); oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_mirror_patching)); } break; case dtrace_object_alloc_id: { // O0: object __ set_info("dtrace_object_alloc", dont_gc_arguments); // we can't gc here so skip the oopmap but make sure that all // the live registers get saved. save_live_registers(sasm); __ save_thread(L7_thread_cache); __ call(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc), relocInfo::runtime_call_type); __ delayed()->mov(I0, O0); __ restore_thread(L7_thread_cache); restore_live_registers(sasm); __ ret(); __ delayed()->restore(); } break; #if INCLUDE_ALL_GCS case g1_pre_barrier_slow_id: { // G4: previous value of memory BarrierSet* bs = Universe::heap()->barrier_set(); if (bs->kind() != BarrierSet::G1SATBCTLogging) { __ save_frame(0); __ set((int)id, O1); __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0); __ should_not_reach_here(); break; } __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments); Register pre_val = G4; Register tmp = G1_scratch; Register tmp2 = G3_scratch; Label refill, restart; bool with_frame = false; // I don't know if we can do with-frame. int satb_q_index_byte_offset = in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_index()); int satb_q_buf_byte_offset = in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_buf()); __ bind(restart); // Load the index into the SATB buffer. PtrQueue::_index is a // size_t so ld_ptr is appropriate __ ld_ptr(G2_thread, satb_q_index_byte_offset, tmp); // index == 0? __ cmp_and_brx_short(tmp, G0, Assembler::equal, Assembler::pn, refill); __ ld_ptr(G2_thread, satb_q_buf_byte_offset, tmp2); __ sub(tmp, oopSize, tmp); __ st_ptr(pre_val, tmp2, tmp); // [_buf + index] := <address_of_card> // Use return-from-leaf __ retl(); __ delayed()->st_ptr(tmp, G2_thread, satb_q_index_byte_offset); __ bind(refill); __ save_frame(0); __ mov(pre_val, L0); __ mov(tmp, L1); __ mov(tmp2, L2); __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, SATBMarkQueueSet::handle_zero_index_for_thread), G2_thread); __ mov(L0, pre_val); __ mov(L1, tmp); __ mov(L2, tmp2); __ br(Assembler::always, /*annul*/false, Assembler::pt, restart); __ delayed()->restore(); } break; case g1_post_barrier_slow_id: { BarrierSet* bs = Universe::heap()->barrier_set(); if (bs->kind() != BarrierSet::G1SATBCTLogging) { __ save_frame(0); __ set((int)id, O1); __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0); __ should_not_reach_here(); break; } __ set_info("g1_post_barrier_slow_id", dont_gc_arguments); Register addr = G4; Register cardtable = G5; Register tmp = G1_scratch; Register tmp2 = G3_scratch; jbyte* byte_map_base = ((CardTableModRefBS*)bs)->byte_map_base; Label not_already_dirty, restart, refill; #ifdef _LP64 __ srlx(addr, CardTableModRefBS::card_shift, addr); #else __ srl(addr, CardTableModRefBS::card_shift, addr); #endif AddressLiteral rs(byte_map_base); __ set(rs, cardtable); // cardtable := <card table base> __ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable] assert(CardTableModRefBS::dirty_card_val() == 0, "otherwise check this code"); __ cmp_and_br_short(tmp, G0, Assembler::notEqual, Assembler::pt, not_already_dirty); // We didn't take the branch, so we're already dirty: return. // Use return-from-leaf __ retl(); __ delayed()->nop(); // Not dirty. __ bind(not_already_dirty); // Get cardtable + tmp into a reg by itself __ add(addr, cardtable, tmp2); // First, dirty it. __ stb(G0, tmp2, 0); // [cardPtr] := 0 (i.e., dirty). Register tmp3 = cardtable; Register tmp4 = tmp; // these registers are now dead addr = cardtable = tmp = noreg; int dirty_card_q_index_byte_offset = in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_index()); int dirty_card_q_buf_byte_offset = in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_buf()); __ bind(restart); // Get the index into the update buffer. PtrQueue::_index is // a size_t so ld_ptr is appropriate here. __ ld_ptr(G2_thread, dirty_card_q_index_byte_offset, tmp3); // index == 0? __ cmp_and_brx_short(tmp3, G0, Assembler::equal, Assembler::pn, refill); __ ld_ptr(G2_thread, dirty_card_q_buf_byte_offset, tmp4); __ sub(tmp3, oopSize, tmp3); __ st_ptr(tmp2, tmp4, tmp3); // [_buf + index] := <address_of_card> // Use return-from-leaf __ retl(); __ delayed()->st_ptr(tmp3, G2_thread, dirty_card_q_index_byte_offset); __ bind(refill); __ save_frame(0); __ mov(tmp2, L0); __ mov(tmp3, L1); __ mov(tmp4, L2); __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, DirtyCardQueueSet::handle_zero_index_for_thread), G2_thread); __ mov(L0, tmp2); __ mov(L1, tmp3); __ mov(L2, tmp4); __ br(Assembler::always, /*annul*/false, Assembler::pt, restart); __ delayed()->restore(); } break; #endif // INCLUDE_ALL_GCS case predicate_failed_trap_id: { __ set_info("predicate_failed_trap", dont_gc_arguments); OopMap* oop_map = save_live_registers(sasm); int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap)); oop_maps = new OopMapSet(); oop_maps->add_gc_map(call_offset, oop_map); DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob(); assert(deopt_blob != NULL, "deoptimization blob must have been created"); restore_live_registers(sasm); AddressLiteral dest(deopt_blob->unpack_with_reexecution()); __ jump_to(dest, O0); __ delayed()->restore(); } break; default: { __ set_info("unimplemented entry", dont_gc_arguments); __ save_frame(0); __ set((int)id, O1); __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), O1); __ should_not_reach_here(); } break; } return oop_maps; }
inline void MacroAssembler::stb(Register d, Register s1, RegisterOrConstant s2) { stb(d, Address(s1, s2)); }
inline void MacroAssembler::stb(Register d, const Address& a, int offset) { if (a.has_index()) { assert(offset == 0, ""); stb(d, a.base(), a.index() ); } else { stb(d, a.base(), a.disp() + offset); } }
inline void MacroAssembler::clrb( Register s1, int simm13a) { stb( G0, s1, simm13a); }
inline void MacroAssembler::clrb( Register s1, Register s2) { stb( G0, s1, s2 ); }
void config::rehash() { mainWinGeo.setX(ini->ReadIni("Pos", "X").toInt()); mainWinGeo.setY(ini->ReadIni("Pos", "Y").toInt()); mainWinGeo.setWidth(ini->ReadIni("Pos", "W").toInt()); mainWinGeo.setHeight(ini->ReadIni("Pos", "H").toInt()); maximized = stb(ini->ReadIni("Pos", "Maximized")); if ((mainWinGeo.width() == 0) && (mainWinGeo.height() == 0)) { mainWinGeo.setWidth(500); mainWinGeo.setHeight(400); maximized = true; } realname = ini->ReadIni("Options", "Realname"); nickname = ini->ReadIni("Options", "Nickname"); altnick = ini->ReadIni("Options", "AltNick"); username = ini->ReadIni("Options", "Username"); server = ini->ReadIni("Options", "Server"); server += ":" + ini->ReadIni("Options", "Port"); password = ini->ReadIni("Options", "Password"); quit = ini->ReadIni("Options", "Quit"); bgImagePath = ini->ReadIni("Options", "BgImagePath"); bgImageEnabled = stb(ini->ReadIni("Options", "bgImageEnabled")); bgImageScale = ini->ReadIni("Options", "bgImageScale").toInt(); if ((bgImageScale < 1) || (bgImageScale > 5)) bgImageScale = Bg_Center; // Default scaling method bool ok = false; bgImageOpacity = ini->ReadIni("Options", "bgImageOpacity").toInt(&ok); if ((bgImageOpacity < 0) || (bgImageOpacity > 100) || (! ok)) bgImageOpacity = 100; // Default opacity (percent) fontName = ini->ReadIni("Options", "FontName"); if (fontName.length() == 0) fontName = "Courier New"; // Default font charset = ini->ReadIni("Options", "Charset"); if (charset.length() == 0) charset = "UTF-8"; // Default charset fontSize = ini->ReadIni("Options", "FontSize").toInt(); if (fontSize == 0) fontSize = 13; // Default size treeWidth = ini->ReadIni("Options", "TreeWidth").toInt(); listboxWidth = ini->ReadIni("Options", "ListBoxWidth").toInt(); if (ini->ReadIni("Options", "TrayNotifyDelay").length() == 0) trayNotifyDelay = 5000; else trayNotifyDelay = ini->ReadIni("Options", "TrayNotifyDelay").toInt()*1000; timeout = ini->ReadIni("Options", "Timeout").toInt(); if (timeout == 0) timeout = 25000; // Default 25,000 ms timestamp = ini->ReadIni("Options", "TimeStamp"); if (timestamp.length() == 0) timestamp = "[hh:mm]"; showTimestmap = stb(ini->ReadIni("Options", "ShowTimeStamp")); showOptionsStartup = stb(ini->ReadIni("Options", "ShowOptions")); connectInvisible = stb(ini->ReadIni("Options", "connectInvisible")); showFavourites = stb(ini->ReadIni("Options", "ShowFavourites")); showUsermodeMsg = stb(ini->ReadIni("Options", "ShowUsermodeMsg")); if (ini->ReadIni("Options", "ShowWhois").length() == 0) showWhois = false; else showWhois = stb(ini->ReadIni("Options", "ShowWhois")); if (ini->ReadIni("Options", "CheckVersion").length() == 0) checkVersion = false; else checkVersion = stb(ini->ReadIni("Options", "CheckVersion")); if (ini->ReadIni("Options", "ShowMotd").length() == 0) showMotd = true; else showMotd = stb(ini->ReadIni("Options", "ShowMotd")); if (ini->ReadIni("Options", "ShowToolBar").length() == 0) showToolBar = true; else showToolBar = stb(ini->ReadIni("Options", "ShowToolBar")); if (ini->ReadIni("Options", "AutoReJoin").length() == 0) autoReJoin = false; else autoReJoin = stb(ini->ReadIni("Options", "AutoReJoin")); if (ini->ReadIni("Options", "ShowTreeView").length() == 0) showTreeView = true; else showTreeView = stb(ini->ReadIni("Options", "ShowTreeView")); if (ini->ReadIni("Options", "ShowButtonbar").length() == 0) showButtonbar = false; else showButtonbar = stb(ini->ReadIni("Options", "ShowButtonbar")); if (ini->ReadIni("Options", "ShowMenubar").length() == 0) showMenubar = true; else showMenubar = stb(ini->ReadIni("Options", "ShowMenubar")); trayNotify = stb(ini->ReadIni("Options", "TrayNotify")); logEnabled = stb(ini->ReadIni("Options", "Log")); logPath = ini->ReadIni("Options", "LogPath"); logChannel = stb(ini->ReadIni("Options", "LogChan")); logPM = stb(ini->ReadIni("Options", "LogPM")); if (ini->ReadIni("Options", "LinksUnderline").length() > 0) linkUnderline = stb(ini->ReadIni("Options", "LinksUnderline")); else linkUnderline = true; // Default value /******************* * CUSTOM COLORS * *******************/ QString c; c = ini->ReadIni("Colors", "Default"); if (c.length() == 0) colDefault = C_BLACK.name(); // Default value else colDefault = c; c = ini->ReadIni("Colors", "LocalInfo"); if (c.length() == 0) colLocalInfo = C_BLUE.name(); // Default value else colLocalInfo = c; c = ini->ReadIni("Colors", "ServerInfo"); if (c.length() == 0) colServerInfo = C_GREEN.name(); // Default value else colServerInfo = c; c = ini->ReadIni("Colors", "Action"); if (c.length() == 0) colAction = C_MAGENTA.name(); // Default value else colAction = c; c = ini->ReadIni("Colors", "CTCP"); if (c.length() == 0) colCTCP = C_BRIGHTRED.name(); // Default value else colCTCP = c; c = ini->ReadIni("Colors", "Notice"); if (c.length() == 0) colNotice = C_RED.name(); // Default value else colNotice = c; c = ini->ReadIni("Colors", "OwnText"); if (c.length() == 0) colOwntext = C_CYAN.name(); // Default value else colOwntext = c; c = ini->ReadIni("Colors", "Highlight"); if (c.length() == 0) colHighlight = C_BROWN.name(); // Default value else colHighlight = c; c = ini->ReadIni("Colors", "Links"); if (c.length() == 0) colLinks = C_BRIGHTBLUE.name(); // Default value else colLinks = c; c = ini->ReadIni("Colors", "Background"); if (c.length() == 0) colBackground = C_WHITE.name(); // Default value else colBackground = c; c = ini->ReadIni("Colors", "Input"); if (c.length() == 0) colInput = C_BLACK.name(); // Default value else colInput = c; c = ini->ReadIni("Colors", "InputBackground"); if (c.length() == 0) colInputBackground = C_WHITE.name(); // Default value else colInputBackground = c; c = ini->ReadIni("Colors", "Listbox"); if (c.length() == 0) colListbox = C_BLACK.name(); // Default value else colListbox = c; c = ini->ReadIni("Colors", "WindowList"); if (c.length() == 0) colWindowlist = C_BLACK.name(); // Default value else colWindowlist = c; c = ini->ReadIni("Colors", "WindowListBackground"); if (c.length() == 0) colWindowlistBackground = C_WHITE.name(); // Default value else colWindowlistBackground = c; /************************** * SCRIPT EDITOR COLORS * **************************/ c = ini->ReadIni("Colors", "ListboxBackground"); if (c.length() == 0) colListboxBackground = C_WHITE.name(); // Default value else colListboxBackground = c; c = ini->ReadIni("Colors", "EditorLineHighlight"); if (c.length() == 0) editorLineHighlight = "#CCFFFF"; // Default value else editorLineHighlight = c; c = ini->ReadIni("Colors", "EditorFunctionDef"); if (c.length() == 0) editorFunctionDef = Qt::darkCyan; // Default value else editorFunctionDef = c; c = ini->ReadIni("Colors", "EditorMetaKeyword"); if (c.length() == 0) editorMetaKeyword = Qt::darkGreen; // Default value else editorMetaKeyword = c; c = ini->ReadIni("Colors", "EditorKeyword"); if (c.length() == 0) editorKeyword = Qt::darkYellow; // Default value else editorKeyword = c; c = ini->ReadIni("Colors", "EditorWindow"); if (c.length() == 0) editorWindow = Qt::darkRed; // Default value else editorWindow = c; c = ini->ReadIni("Colors", "EditorVariable"); if (c.length() == 0) editorVariable = Qt::darkBlue; // Default value else editorVariable = c; c = ini->ReadIni("Colors", "EditorComment"); if (c.length() == 0) editorComment = Qt::gray; // Default value else editorComment = c; c = ini->ReadIni("Colors", "EditorBackground"); if (c.length() == 0) editorBackground = Qt::white; // Default value else editorBackground = c; c = ini->ReadIni("Colors", "EditorText"); if (c.length() == 0) editorText = Qt::black; // Default value else editorText = c; c = ini->ReadIni("Colors", "EditorLineNumBackground"); if (c.length() == 0) editorLineNumBackground = Qt::lightGray; // Default value else editorLineNumBackground = c; c = ini->ReadIni("Colors", "EditorLineNumText"); if (c.length() == 0) editorLineNumText = Qt::black; // Default value else editorLineNumText = c; c = ini->ReadIni("Editor", "FontName"); if (c.length() == 0) editorFontName = "Courier New"; // Default value else editorFontName = c; c = ini->ReadIni("Editor", "FontSize"); if (c.length() == 0) editorFontSize = 12; // Default value else editorFontSize = c.toInt(); if (treeWidth < 25) treeWidth = 125; if (listboxWidth < 25) listboxWidth = 150; if (treeWidth > 200) treeWidth = 200; if (listboxWidth > 200) listboxWidth = 200; }